Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why java does not support multiple inheritance [duplicate]

Tags:

java

Possible Duplicate:
Why there is no multiple inheritance in Java, but implementing multiple interfaces is allowed

hi all, I am new to java and when I am try to use multiple inheritance concept in java its showing a compile time error.Why java does not support it.I heard about interface key word but do not know why java support it directly. please help me in this and explain.

like image 990
Subhransu Mishra Avatar asked Sep 22 '10 09:09

Subhransu Mishra


1 Answers

The main problem with multiple inheritance (alluded to by Colin and Rin) is known is The Diamond Problem.

I quote:

The diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?

like image 98
AlcubierreDrive Avatar answered Sep 22 '22 06:09

AlcubierreDrive