Types of Inheritance

Java support simple, multi-level, hierarchical inheritance.

  • Simple Inheritance

    simple inheritance involve one parent and one child class.


    Example

    
    class A 
    {
    }
    class B extends A
    {
    }


  • Multi-Level Inheritance

    multi-level inheritance involve one parent, one child class and a grand child class.



  • Example :

    
    class A
    {
    }
    class B extends A
    {
    }
    class C extends B
    {
    }

  • Hierarchical Inheritance

    Hierarchical inheritance involve one parent and multiple children class.


    Example :

    
    class A
    {
    }
    class B extends A
    {
    }
    class C extends A
    {
    }