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

How do you sort in java?

578


what do you mean by classloader?

541


Are generics important java?

515


What is bifunction in java?

664


What is the history of java?

533






Define an abstract class with reference to java.

566


What do you mean by platform independence of Java?

527


How many bytes is a string?

556


Why multiple inheritance is not supported by java?

505


What is object cloning in Java?

625


What is the difference between a scrollbar and a scrollpane?

548


what is thread in Java ?

616


List some oops concepts in java?

573


What are filterstreams?

601


How do you check if a character in a string is a digit or letter?

501