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

Why is the main method declared static?

589


What does the ‘static’ keyword mean? Is it possible to override private or static method in java?

569


Write a program to check for a prime number in java?

564


Which programming language is best in future?

529


What is difference between arraylist and list in java?

589






How do you do a line break in java?

501


What are the differences between checked exception and unchecked exception?

533


What is string variable?

576


Write java program to reverse string without using api?

560


What is default switch case? Give example.

578


What is json parser in java?

621


What is difference between class and object in java?

533


Is it possible to specify multiple jndi names when deploying an ejb?

561


What do you mean by local variable and instance variable?

521


What is join () in java?

534