Skip to content

Commit 6a960cd

Browse files
Method Overriding in Java
1 parent a2784f7 commit 6a960cd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

48.Method_Overriding/CWH1.java

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class A{
2+
public void meth1() {
3+
System.out.println("I am method 1 of class A");
4+
}
5+
}
6+
7+
class B extends A {
8+
@Override
9+
public void meth1(){
10+
System.out.println("I am method 1 of class B");
11+
}
12+
}
13+
public class CWH1 {
14+
public static void main(String[] args) {
15+
A a = new A();
16+
a.meth1();
17+
18+
B b = new B();
19+
b.meth1();
20+
}
21+
}

0 commit comments

Comments
 (0)