Skip to content

Commit 3041916

Browse files
committed
Multiple inheritance with annonymous object
1 parent 974b189 commit 3041916

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

MultipleInheritance.java

+18-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,26 @@ public static void main(String[] args){
1515
c.method();
1616

1717
A a = new A(){
18+
@Override
1819
public void method(){
19-
System.out.println("HAHhahahahahhaha");
20+
System.out.println("Hello Method");
2021
}
2122
};
2223
a.method();
24+
25+
//annonymous object
26+
27+
new C().method();
28+
29+
new A(){
30+
@Override
31+
public void method(){
32+
System.out.println("I am annonymously created and overriden");
33+
}
34+
}.method();
2335
}
24-
}
36+
}
37+
38+
39+
40+

0 commit comments

Comments
 (0)