- 1

Can we do multiple inheritance in Java?

Statement :In Java, we can do multiple inheritances among interfaces. But still, we can't do the multiple inheritances among the classes. Question : 1 ) Do you agree above statement? 2) If agree, Why we can't do the multiple inheritances in Java among the classes? Briefly explain your ideas and thoughts with suitable examples. If not agree, provide your answer against that statement...

26th Oct 2018, 4:52 PM
Vansh
Vansh - avatar
1 ответ
+ 3
I agree. As we know each and every class extends Object class directly or indirectly so when you extend more than one class then that will result in the dimond problem (assuming you know the dimond problem) If you know c++ there is a virtual keyword that we use to get around with a dimond problem but java doesn't seem to have one so I think that could be one of the reason java don't allow you to inherit from more than one class.
27th Oct 2018, 7:27 AM
Tanay
Tanay - avatar