Does Java support Multiple Inheritance?

This is probably often asked at interviews. But the question is incomplete.

There are three different types of inheritance in Java:

  • inheritance of state
  • inheritance of implementation*
  • inheritance of type

* also called “inheritance of behaviour”

You can inherit state of one class. Object doesn’t have any state so you don’t need to. And if you extend some class then that class can inherit state from another class. This is single inheritance because each element in this list  of types has only one single superclass.

You can define one single superclass and multiple interfaces to inherit type and implementation from them. Interfaces can contain implemented methods (default or static) since Java 8.

The Java tutorial explains it here:

So the answer is “No” but also “Yes”.

One thought on “Does Java support Multiple Inheritance?”

Leave a Reply

Your email address will not be published. Required fields are marked *