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 foreach loop in java?
What does .equals do in java?
How do you execute a thread in java?
What is the maximum size of arraylist in java?
What does I ++ mean?
What is an association?
What is Java Reflection API? Why it’s so important to have?
What is polymorphism in java? What are the kinds of polymorphism?
Can we override singleton class?
What is the difference between the direct buffer and non-direct buffer in java?
How do you escape sequences in java?
What is an infinite loop?
What is lazy programming?
What is flag in java?
What is passing by reference in java?