Search⌘ K

Multiple Inheritance

Explore the concept of multiple inheritance in Java by understanding how interfaces enable a class to inherit from multiple sources. Learn the key distinctions between interfaces and abstract classes, and see practical implementation examples to write modular, reusable code.

What Is multiple inheritance?

When a class is derived from more than a single base class, i.e. when a class has more than one immediate parent classes, it is an instance of Multiple Inheritance. Example:

  • A Hyundai Elantra IS A Car
  • A Hyundai Elantra IS A Sedan as well

Implementation

In Java, a class can’t extend from more than one class. So the ...