Interview Q&A / Object-Oriented Programming

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What are the types of inheritance, and which does Java support through classes?

SHORT ANSWER

Single, multilevel, hierarchical, multiple and hybrid. Java supports the first three with classes; multiple inheritance of classes is not allowed, but a class can implement many interfaces.

Explain it simply

Think of a family tree. Single: a child has one parent class. Multilevel: grandparent, parent, child. Hierarchical: one parent with several children. Multiple: a child with two parents, which Java forbids for classes. Hybrid mixes several of these.

Java skips multiple class inheritance to avoid confusion about which parent's version to use. Interfaces fill the gap, because they describe abilities and do not carry state.

Example

java
class Vehicle { void start() { System.out.println("starting"); } }

class Car extends Vehicle { }                 // single
class ElectricCar extends Car { }             // multilevel (Vehicle > Car > ElectricCar)
class Bike extends Vehicle { }                // hierarchical (Car and Bike share Vehicle)

interface Chargeable { void charge(); }
interface Connected { void connect(); }
class SmartCar extends Car implements Chargeable, Connected {   // many abilities
    public void charge() { }
    public void connect() { }
}

Python and C++ do allow multiple inheritance of classes, with rules such as MRO to decide the order.

What to say in the interview

"Common types are single, multilevel, hierarchical, multiple and hybrid. Java supports single, multilevel and hierarchical inheritance for classes, and gets multiple inheritance of type through interfaces to avoid the diamond problem."

Common mistakes

  • Saying Java does not support multiple inheritance at all. It does, through interfaces.

#inheritance#java#oop

Related questions

Practise more Object-Oriented Programming questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Object-Oriented Programming quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.