Java
Programming and Technical
Why does java not support multiple
inheritance?
Read Solution (Total 4)
-
- Java does not support multiple inheritance because if suppose there is a method named as display() in class A and class B. Now when the object of class C which is a child class is made and display() is called, then JVM gets confused as which version of the display() to be called whether it is from class A or class B. So therefore this results in ambiguity
- 9 years agoHelpfull: Yes(4) No(0)
- In java a class does not inherit more than one class at a time. But it can be possible using Interface
- 9 years agoHelpfull: Yes(1) No(0)
- because of ambiguity
- 10 years agoHelpfull: Yes(0) No(0)
- In multiple inheritance there is one sub class and n number of Super classes. So, the super() is confused to call which super class . This ambiguity problem is Known as Diamond problem or Constructor Chaining problem. In java when we use class multiple inheritance is not possible but when we use Interface in the place of class then the multiple inheritance is supported.
. - 3 years agoHelpfull: Yes(0) No(0)
Java Other Question