It creates new classes using existing classes. So that the new classes will acquire all the feature of the existing classes is called Inheritance.
Types of Inheritance
- Single Inheritance
Producing sub classes from single super class is called single inheritance.
- Multilevel Inheritance
In Multilevel Inheritance a sub class will be inheriting a super class and as well as the sub class act as the super class to other class.
- Multiple Inheritance
Producing sub classes from multiple super classes is called multiple inheritance.
Multiple inheritance is not available in java.
- Hierarchical Inheritance
Producing many sub classes from single super class is called hierarchical inheritance.
- Hybrid Inheritance
Hybrid Inheritance is the combination of Single and Multiple Inheritance.Hybrid inheritance is also not supported in java.
Why multiple inheritance is not available in java?
It leads to confusion for a java program. To reduce the complexity and simplify the language, multiple inheritance is not available in java.
The programmer can achieve multiple inheritance using interfaces.