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 map in java?
How do you sort an array in java?
What is equlas() and hashcode() contract in java? Where does it used?
These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }
what is mena by object block any what is the use of that
What are encapsulation, inheritance and polymorphism?
What is foreach loop in java?
What is the method in java?
Can a class with private constructor be extended?
What is oop principle in java?
v-model life cycle
What is the difference between preemptive scheduling and time slicing?
Difference between collection, collection and collections in java?
What is arraylist e in java?
What are thread groups?