Inheritance- One class can acquire the properties of another class.
Inheritance promotes the reusability of code
To inherit from a class, use the extends keyword.
In Oops there are 5 types of Inheritance-
Single Inheritance
Multilevel Inheritance
Multiple Inheritance
Hybrid Inheritance
Hierarchical Inheritance
Java does not support to Multiple and Hybrid Inheritance.
Because of Ambiguity problem, we can’t extend’s 2 class at a same time. Instead of multiple inheritance Java support to interfaces and by using interface will implements 2 or more interfaces with in single class by “,” separated.
Benefits of Inheritance-
Code reusability
We can achieve Runtime Polymorphism using Inheritance.