0
Why multiple inheritance is not possible in java
inheritance means getting variables and methods from super class to sub class
4 Answers
+ 3
Implement it is complicate, for example: "diamond problem": https://en.wikipedia.org/wiki/Multiple_inheritance
0
see this example
class A//class A is sub class for test class
{
int i=10;
void m1 ()
{
--x implementation --
}
class B // class B is also sub class for test class
{
int i=20;
void m1 ()
{
--y implementation --
}
}
class test // super class for A,B
{
while accessing i from class A , B
and m1 () method the Compiler with get
confusion which variable has to to
so to overcome that come problem
multiple inheritance is not possible in java
}
0
Because multiple inheritance ambiguity some scenario in Java. But as a solution you can use interface.