Wants to know that why we are not use multiple inheritance in java ? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Wants to know that why we are not use multiple inheritance in java ?

12th Jul 2016, 5:22 PM
Sourabh Jain Shan
Sourabh Jain Shan - avatar
4 Réponses
+ 1
multiple inheritance means,,many base class and one derived class,suppose class A and B are base class for class D,which is inheriting properties of class A and B,now if both class A and B are having a method of same name,then while caling derive class object,compiler gets confuced,this is called ambiguity of multiple inheritance.so we dont use this in java
21st Jul 2016, 2:52 PM
Jyoti Sheokand
Jyoti Sheokand - avatar
0
but why we can't use it is their any reason behind it. ?
12th Jul 2016, 7:21 PM
Sourabh Jain Shan
Sourabh Jain Shan - avatar
0
Multiple Inheritance comes with a problem, commonly known as 'Deadly Diamond of Death'. That's why it is not supported in Java.
12th Jul 2016, 7:43 PM
Mohit Gupta
Mohit Gupta - avatar
- 1
multiple inheritance is not directly used in Java but can be implemented indirectly by using the concept of interfaces.
12th Jul 2016, 6:55 PM
uzma shaikh