What is the reason that multiple inheritance is not possible
in java??
Answer Posted / gayathri
This is to avoid "Diamond problem"....Lets say there are 4 classes A,B,C,D..A is a superclass...The two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C? ...To avoid this issue, Java dint allow multiple inheritance..
Having said that, also note that Java allows multiple inheritance through multiple interface implementation
| Is This Answer Correct ? | 10 Yes | 1 No |
Post New Answer View All Answers
What is the difference between heap and stack memory?
What is method overloading and method overriding?
What do you mean by scope of variable?
What is high level language in computer?
What is difference between wait and notify in java?
How can an exception be thrown manually by a programmer?
What is java util concurrentmodificationexception?
Can we create an object of static class in java?
How do I get a substring?
Can we have try without catch block?
What do you mean by compiler?
Can a source file contain more than one class declaration?
How can we achieve thread safety in java?
What is a data structure java?
Is array primitive data type in java?