Skip to content

Commit 7272da0

Browse files
method overriding through inheritance
1 parent d917512 commit 7272da0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class AreaOfRectangle{
2+
void Result(){
3+
int a=100,b=200;
4+
System.out.println("Area of Rectangle is : "+ (a*b));
5+
}
6+
}
7+
8+
//Method overidding
9+
class AddTwoNumber extends AreaOfRectangle{
10+
void Result(){
11+
super.Result();
12+
int a=11,b=234;
13+
System.out.println("Addition of two number is : " + (a+b));
14+
}
15+
}
16+
17+
public class MethodOveridding {
18+
public static void main(String args[]){
19+
AddTwoNumber obj = new AddTwoNumber();
20+
obj.Result();
21+
}
22+
}
23+

0 commit comments

Comments
 (0)