Hot Student Stories
top-5-grammar-and-spelling-checkers-to-rock-in-2019

Why multiple inheritance is not possible in java?

Victoria Fowler

in Student Loans

follow
followin
1 answer
2 views

1 answer


Chelsea Hayes on February 24, 2019

Let Me explain with an example. Suppose consider a method funX() which is in class Z. Suppose a programmer ABC inherited the class Z to class X and overrided the funX().So this class will have the new implementation of funX(). Suppose a programmer DEF inherited the class Z to class y and overrided the funX().So this class is going to have the new implementation of funX(). If Multiple Inheritance is permitted in java, then if the new programmer inherited both the classes and that she had not done any overriding of method funX() then if he calls the funX() ,the JVM will not know which method to call i.e., the method in class X or method in class Y. Because of this inconsistencies,Multiple inheritance is not allowed in java.


Add you answer