Why java does not supports multiple inheritance?

Answer Posted / shree

Multiple inheritance eliminated from java because it leads to confusion in many of cases & causes ambiguity.
So to avoid that complexity java does not support multiple inheritance.

/Multiple inheritance program
Class A
{
public void show(){.....}
}

Class B extends A
{
public void show(){.....}
}

Class C extends A{
public void show(){......}
}
Class D extends B,C{ // not supported by java leads to syntax error.
}


Here class D will get confuse which show() method to execute as there are 2 show() methods are available inherited from class B & C.


but to provide functionality of inheritance java provides new concept called INTERFACE.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a conditional equation?

786


What is the difference between an object-oriented programming language and object-based programming language?

778


What is the main purpose of serialization in java?

789


What are classloaders?

780


What is data and its types?

767


What is the main purpose of java?

760


Write a method that will remove given character from the string?

783


Give us a program to check for parenthesis matching using stack.

760


Are private methods final?

663


Can you pass functions in java?

786


what is the significance of listiterator in java?

814


What is object-oriented programming?

800


What checkbox method allows you to tell if a checkbox is checked?

772


Explain what access modifiers can be used for methods?

802


What is function and method in java?

731