Open links in new tab
  1. Java does not support multiple inheritance with classes to avoid ambiguity and complexity. However, you can simulate multiple inheritance using composition, where one class contains instances of other classes and delegates functionality.

    Here’s a simple example demonstrating this concept:

    // Parent Class 1
    class Parent1 {
    void displayParent1() {
    System.out.println("This is Parent1");
    }
    }

    // Parent Class 2
    class Parent2 {
    void displayParent2() {
    System.out.println("This is Parent2");
    }
    }

    // Child Class using Composition
    class Child {
    private Parent1 parent1 = new Parent1(); // Instance of Parent1
    private Parent2 parent2 = new Parent2(); // Instance of Parent2

    void displayBoth() {
    parent1.displayParent1(); // Delegating call to Parent1
    parent2.displayParent2(); // Delegating call to Parent2
    }
    }

    // Main Class
    public class MultipleInheritanceExample {
    public static void main(String[] args) {
    Child child = new Child();
    child.displayBoth();
    }
    }
    Copied!

    Output:

    This is Parent1
    This is Parent2
    Copied!

    Key Considerations:

    Feedback
  2. Types of inheritance in Java: Single,Multiple,Multilevel & Hybrid

    • “Multiple Inheritance” refers to the concept of one class extending (Or inherits) more than one base class. The inheritance we learnt earlier had the concept of one base class or parent. The problem with “multiple inheritance” is that the derived class will have to manage the dependency on two base classes. Note 1: Multiple Inheritance is very rare...
    See more on beginnersbook.com
  3. Multiple Inheritance in Java: Explained with Examples …

    Feb 13, 2025 · In this article, we will deep-dive into the concept of multiple inheritance in Java, building upon previous tutorials on inheritance, interface, and …

  4. Types of Inheritance in Java - Scientech Easy

    • See More

    Dec 20, 2025 · Java supports multiple inheritance only through interfaces, where a class can implement multiple interfaces safely. Look at the figure below where class C is derived from two superclasses A …

  5. Multiple Inheritance in Java - Multiple inheritance …

    Jan 4, 2023 · In the following diagram, class D extends classes A and B. In this way, D can inherit the non-private members of both classes. But, in Java, we cannot …

  6. Multiple inheritance in java3 (1).pptx - SlideShare

    Conclusion :- • Java does not support "multiple inheritance" (a class can only inherit from one parent class).