- 1

Is Java Has Multiple Inheritance

Inheritance

31st Jan 2022, 3:12 AM
Aryan Baranwal
Aryan Baranwal - avatar
8 Answers
+ 2
no this way class Class3 extends Class1, Class2 { // wrong but can use interfaces class Class3 implements Interface1, Interface2 { interface can have default (non-abstract) methods
31st Jan 2022, 3:24 AM
zemiak
+ 5
I think you already know and clearly mentioned that in lesson. see here clearly mentioned https://www.geeksforgeeks.org/java-and-multiple-inheritance/amp/ It is possible using interfaces.
31st Jan 2022, 3:37 AM
A͢J
A͢J - avatar
+ 3
A͢J in subsequent versions of Java, methods were allowed to be defined in the interface definition itself, and we end up with multiple inheritance being possible(and hence the "diamond problem" again). So technically, Java has multiple inheritance, but no one accepts it
31st Jan 2022, 5:13 AM
Rishi
Rishi - avatar
+ 3
A͢J so now there's no point in not allowing one class extending multiple classes, or is there any?
31st Jan 2022, 10:05 AM
Rishi
Rishi - avatar
+ 2
Rishi That is using interface but not using extends. I said using interface is possible. Diamond problem is also following interface. https://code.sololearn.com/cRffHX3lFIEg/?ref=app
31st Jan 2022, 9:33 AM
A͢J
A͢J - avatar
+ 1
No java does not have multiple inheritance but we can achieve multiple inheritance by using interface
1st Feb 2022, 10:20 AM
DevjiCoder
DevjiCoder - avatar
0
Yes it's through interfaces not by using inheritance....keyword for interface is implements
31st Jan 2022, 1:53 PM
Naveen Royals
0
No, Java not support multiple inheritance but you can do using interface.
1st Feb 2022, 9:17 PM
Chandan Maurya
Chandan Maurya - avatar