+ 5

In java why we can't perform multiple inheritance? It is possible by using interface only not directly why??

20th Apr 2018, 6:55 PM
DN HAMSAVENI
DN HAMSAVENI - avatar
3 odpowiedzi
+ 3
24th Apr 2018, 6:04 AM
Хорс
Хорс - avatar
+ 8
Java does not support that because if you have 2 classes with the same method signature and then you "extend" both classes in your class, and then you try to instantiate an object of that class calling the method in both extended classes, the JVM have no way to know which one is the one you want, that's call the diamond problem.
20th Apr 2018, 7:30 PM
Roberto Guisarre
Roberto Guisarre - avatar
+ 6
super
12th Sep 2018, 5:29 PM
Dmitriy Yakovlev
Dmitriy Yakovlev - avatar