Thursday, 9 July 2015

Types of inheritance

Topics
1.  Introduction to inheritance in java

Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object.
The idea behind inheritance in java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of parent class, and you can add new methods and fields also.
 2. Types of  inheritance in java


On the basis of class, there can be three types of inheritance in java: single, multilevel and hierarchical.
In java programming, multiple and hybrid inheritance is supported through interface only. We will learn about interfaces later.
types of inheritance in java


When a class extends multiple classes i.e. known as multiple inheritance. For Example:
multiple inheritance in java

No comments:

Post a Comment