Multiple Inheritance In Java

Multiple Inheritance in Java has always been a topic of debate among people.

Based on the Oracle’s Java tutorial ( inheritance is a concept reserved to classes only, not Interfaces, as what is inherited is the state and behavior which interfaces don’t have.

So, java does not support multiple inheritance but this questions can be asked in other sense also, like:
If the question was: Can we extend more than one class, the answer is no.
If the question was: Can we inherit state and behavior from different classes, the answer is yes with polymorphism.

There are two methods explained in this post of doing multiple inheritance in java.

1. Using interface (see Method 1).
2. Also there is another method do to it (see Method 2)

Method 1:




multiple inheritance using interface

Method 2:





multiple inheritance

%d bloggers like this: