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
Do you need to import math in java?
How do you sort a set in java?
What is public static void main?
How do you declare an empty string?
Explain about public and private access specifiers?
Where to store local variables?
Do I need java for windows 10?
Why javac is not recognized?
How do you add an element to a hashset in java?
What is %d in printf?
What is java argument list?
How do you escape json?
How can we find the sum of two linked lists using stack in java?
Does constructor creates the object ?
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?