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
Difference between current previous versions of Java?
What is array command?
When should I use a singleton?
What is parsing a string?
What is the main use of java?
How many types of constructors are used in java?
What are the legal operands of the instanceof operator?
Is it possible to cast an int value into a byte variable? What would happen if the value of int is larger than byte?
Can we execute java program without main method?
Can I import same package/class twice?
Why synchronization is important?
When do we need to use internal iteration? When do we need to use external iteration?
What is function and its uses?
What is tree in java?
Differentiate between the constructors and methods in java?