What is the reason that multiple inheritance is not possible
in java??



What is the reason that multiple inheritance is not possible in java??..

Answer / 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

More Core Java Interview Questions

What an i/o filter?

1 Answers  


What is the GregorianCalendar class?

2 Answers   HCL,


how can be object class inherited to all class in a program when java does not support multiple inheritance??

4 Answers  


How are the elements of a gridbaglayout organized?

1 Answers  


Can you have a constructor in abstract class?

18 Answers   HCL,


What do you mean by ternary operator in java?

1 Answers  


What is inheritance?

5 Answers   Accenture, Hexaware, Syntel,


Can a main method be declared final?

1 Answers  


What is CardLayout?

1 Answers   Infosys,


Can you inherit a constructor java?

1 Answers  


What is serializable interface?

13 Answers   Infosys, Probity Soft, Seed Infotech,


Does sprintf add a null terminator?

1 Answers  


Categories