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
Why is the main method declared static?
What does the ‘static’ keyword mean? Is it possible to override private or static method in java?
Write a program to check for a prime number in java?
Which programming language is best in future?
What is difference between arraylist and list in java?
How do you do a line break in java?
What are the differences between checked exception and unchecked exception?
What is string variable?
Write java program to reverse string without using api?
What is default switch case? Give example.
What is json parser in java?
What is difference between class and object in java?
Is it possible to specify multiple jndi names when deploying an ejb?
What do you mean by local variable and instance variable?
What is join () in java?