Hybrid Inheritance In Java

(Last Updated On: February 28, 2019)

Hybrid inheritance in java with example and simple program – In hybrid inheritance, we use mixed of different types of inheritance relationship in java program.

For example, we can mix multilevel and hierarchical inheritance etc.

Prerequisite:

Before reading Hybrid inheritance in java language, you can read following different types of inheritance. Recommended to read simple Java inheritance example first.

 

Hybrid Inheritance Example

In below hybrid inheritance program example, multilevel and hierarchical inheritance both are mixed.

Multilevel ->

Son class inherits Father class, Father class inherits Grand Father class.

Daughter class inherits Father class, Father class inherits Grand Father class.

Hierarchical->

Son and Daughter both inherit Father class.

Above Multilevel and hierarchical statements are shown in below figure. Combination of both is shown as hybrid inheritance.

Hybrid inheritance in java
Hybrid inheritance in java

 

Hybrid Inheritance Example

 

Output:
Son…
GradFater’s land
Father’s Car
Father’s home
Son’s mobile
Daughter…
GradFater’s land
Father’s Car
Father’s home
Daughter’s purse