Java absolutly support multiple inheritence in terms of
Interface.We can extend one class only to avoid ambiguity
problem.In interface we have to define the functions.So we
don't get any ambiguity.In c++ it is big problem with
multiple inheritence but in JAVA this thing is improved by
To say why java doesn't support inheritance directly like c++
should be the diamond problem faced by c++,
(Diamond problem is an ambiguity that arises when 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 it), and B and C have overridden that
method differently, then via which class does it inherit: B,
Java supports multiple inheritence indirectly through the
use of interface. In case we are able to extend more than
one class then there would be a confusion of which method to
process in case both classes have same method name(Same
method signature also).
In case of using interfaces to support multiple inheritance
we escape this problem as we define the methods that are
java does not supports multiple inheritence at all.but it
supports similar feature interface.Which removes the
ambiguity problem(Deadly Diamonds Of Death) and complexity
of multiple inheritence.Although interface is not the part
of inheritence because inheirtence is achieved in java
through extends keyword only.Interface is the part of
aggregation not inheritence.
Multiple inheritance means derive class from multiple
classes but java can't extend multiple classes. it can
extend one class but multiple interfaces. so create
multiple interfaces n then implement it.
Java have such fzacility to avoid ambiguty.
java doesn't support multiple inheritance directly because it leads to overiding of methods when both extended class have a same method name. this will leads to ambiguity in executing. this problem can be solved using interface which works similar to the multiple inheritance but the methods are defined in the subsequent classes so it does not create any ambiguity.
The reasons for omitting multiple inheritance from the Java
language mostly stem from the "simple, object oriented, and
familiar" goal. As a simple language, Java's creators
wanted a language that most developers could grasp without
extensive training. To that end, they worked to make the
language as similar to C++ as possible (familiar) without
carrying over C++'s unnecessary complexity (simple).
In the designers' opinion, multiple inheritance causes more
problems and confusion than it solves. So they cut multiple
inheritance from the language (just as they cut operator
overloading). The designers' extensive C++ experience
taught them that multiple inheritance just wasn't worth the
Instead, Java's designers chose to allow multiple interface
inheritance through the use of interfaces, an idea borrowed
from Objective C's protocols. Multiple interface
inheritance allows an object to inherit many different
method signatures with the caveat that the inheriting
object must implement those inherited methods. Multiple
interface inheritance still allows an object to inherit
methods and to behave polymorphically on those methods. The
inheriting object just doesn't get an implementation free
java does not support multiple inheritance because of ambiguity 0r confusion problem.but multiple inheritance can be achieved through the concept called interfaces.
A class can implement one or more interfaces.
class A extends B extends C
class A extends B implements C
from interface to class we are inheriting use the keyword