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

Difference between current previous versions of Java?

553


What is array command?

553


When should I use a singleton?

554


What is parsing a string?

586


What is the main use of java?

569






How many types of constructors are used in java?

534


What are the legal operands of the instanceof operator?

556


Is it possible to cast an int value into a byte variable? What would happen if the value of int is larger than byte?

542


Can we execute java program without main method?

516


Can I import same package/class twice?

490


Why synchronization is important?

584


When do we need to use internal iteration? When do we need to use external iteration?

603


What is function and its uses?

562


What is tree in java?

487


Differentiate between the constructors and methods in java?

501