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
What is the meaning of immutable regarding string?
Can an object be null?
What is data type example?
What design pattern you have used in your project? I answered Factory pattern, how it is implemented? What are its advantage? Do know about Abstract Factory?
What is ellipsis in java?
What is bom encoding?
What is bool mean?
What are java packages? What is the significance of packages?
What is an inner class in java?
Can I extend singleton class in java?
Why can't we use static class instead of singleton?
Explain heap sort?
Write a function for palindrome and factorial and explain?
How do you create a reference in java?
Why do we override tostring method in java?