Why Multiple inheritance is not supported by Java?

Kamal Kishor
Kamal Kishor

Posted On: Jan 07, 2021

 

Multiple Inheritance is a mechanism by which a subclass acquires the properties of more than one class. A class cannot be derived from more than one class in JAVA. For instance, consider a case where class C extends class A and class B and both class A and B have the same method display() because the java compiler cannot decide which display method it should inherit. In Java, The main reason behind the impossibility of multiple inheritances is to prevent ambiguity. To overcome this problem, The concept of interface is adopted in Java by which a class can implement one or more interfaces to achieve multiple inheritances.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Java inheritance interview questions

    Explain Inheritance in Java?

    Inheritance is one of the most important pillars of the OOPs (Object Oriented programming system). Inheritance in Java is a mechanism by which one class acquires all the properties and behaviors of an...

    Java inheritance interview questions

    Enlist diffrent types of Inheritance supported by Java?

    The various kinds of inheritance supported by Java.Single Inheritance: Single Inheritance is the easy inheritance of all, while a group lengthens another group (Simply one class) then one cal...

    Java inheritance interview questions

    What is the difference between Inheritance and Encapsulation?

    The major difference between Inheritance and Encapsulation are as follows -Inheritance EncapsulationInheritance is the process or mechanism by which you can acquire the properties and b...