What is inheritance and types of inheritance in Java?

: 852
Paper : Java FAQ (Frequently Asked Questions and answers) for freshers | Platform : Object-oriented programming Language | Category : Programming FAQs

Inheritance means inheriting the properties of one class to another class. The class whose property is inherited is known as parent class and in which property is inherited is known as child class. The types of inheritance Java supports are:

  • Single Inheritance: There are only two classes one is whose property is inheriting into another class.
  • Multilevel Inheritance: Multiple classes exist in this. There is only one superclass. Example: Suppose there are three classes the property of the first class is inherited into the second class and the property of the second class is inherited into the third class.
  • Hierarchical Inheritance: When the property of one class inherited into two child classes. 

One more inheritance exists in the OOPs i.e Multiple Inheritance but Java does not support multiple inheritances.