- 1
Is Java Has Multiple Inheritance
Inheritance
8 ответов
+ 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
+ 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.
+ 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
+ 3
A͢J so now there's no point in not allowing one class extending multiple classes, or is there any?
+ 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
+ 1
No java does not have multiple inheritance but we can achieve multiple inheritance by using interface
0
Yes it's through interfaces not by using inheritance....keyword for interface is implements
0
No, Java not support multiple inheritance but you can do using interface.