Skip to content

Commit 0247712

Browse files
Create Method Overriding
This program shows the functionality of Method-Overriding in JAVA.
1 parent 7f1df0c commit 0247712

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Method Overriding

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class CarClass
2+
{
3+
public int speed_Limit()
4+
{
5+
return 100;
6+
}
7+
}
8+
class Ford extends CarClass
9+
{
10+
public int speed_Limit()
11+
{
12+
return 150;
13+
}
14+
}
15+
class Override
16+
{
17+
public static void main(String args[])
18+
{
19+
CarClass obj=new Ford();
20+
int num=obj.speed_Limit();
21+
System.out.println("Speed Limitis : "+num);
22+
}
23+
}

0 commit comments

Comments
 (0)