Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

What is Inheritance in JAVA

 The process by which one class acquires the data members, methods of other
class is known as Inheritance.
 The class which inherit other class is known as child class and the class which
is inherited by other class is known Parent Class.
 extends Keyword is used to inherit other.
 Inheritance helps us to reuse the code which is already done but present in
other class. So that we can only write the unique code.
 One Class cannot extends two classes simultaneously.

What are the types of Inheritance in JAVA

 There are 5 types of inheritance which are as listed below:


 Out of which multiple inheritance is not supported.

Single Inheritance:

 One class entends to other class i.e. class A entends B.

Multilevel Inheritance:

For example class C extends class B and class B extends


class A.

Hierarchical Inheritance:

For example, classes B, C & D extends the same class A.


Multiple Inheritance:

Multiple Inheritance is not possible in JAVA.

Multiple Inheritance occurs when one class


entends two classes simultaneously.

For Example. Class C extends Class A, B

Hybrid Inheritance:

 When Combination of more than one inheritance in signal program then it’s
called Hybrid Inheritance.
 Means two or more type of inheritance used in same program then its called
Hybrid Inheritance.

You might also like