Why does java doesnot support multiple inheritance?
Answer Posted / rana.ankur
Suppose consider a method funX() which is in class Z.
Suppose a programmer A inherited the class Z to class X and
overrided the funX().So this class will have the new
implementation of funX(). ie class X extend Z
Suppose a programmer D inherited the class Z to class Y and
overrided the funX().So this class will have the new
implementation of funX(). ie class Y extend Z
If Multiple Inheritance is permitted in java, then if the
new programmer C inherited both the classes and he didn't
done any overriding of method funX() then if he calls the
funX() ,the JVM will not know which method to call i.e.,
either the method in class X or method in class Y.
Because of this inconsistencies,Multiple inheritance is not
permitted in java
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is return in java?
Explain restrictions for using anonymous inner classes?
What is difference between word and integer?
How many characters is 16 bytes?
What is hashmap in java?
Is linkedlist thread safe in java?
Why java doesn’t support multiple inheritances?
How to call one constructor from the other constructor ?
What are the main features of java?
What is adapter in java?
What is flag in python?
What does the “static” keyword mean? Can you override private or static method in java?
What is import java util arraylist?
What is the driver class?
What is class and its types?