Why not supported multiple inheritance in java | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why not supported multiple inheritance in java

7th Nov 2019, 4:03 PM
akash raut
2 Antworten
+ 1
class A { display(); } class B { display(); } class C extends A,B { } main (){ C obj = new C(); obj.display(); } In the above program which display method is executed? Confusing right? Just in order to remove this ambiguity Java doesn't support multiple inheritance using Classes. But you can always do multiple inheritance using interfaces in Java. Kindly ignore the syntax, it is just for understanding purpose.
7th Nov 2019, 4:16 PM
Avinesh
Avinesh - avatar
0
Thanks bro
9th Nov 2019, 4:09 PM
akash raut