0% found this document useful (0 votes)
2 views7 pages

Inheritance

Inheritance in Java is a concept that allows one class to acquire properties and behaviors from another class, similar to a parent-child relationship. There are four types of inheritance in Java: Single, Multi-Level, Hierarchical, and Hybrid, while Multiple Inheritance is not supported due to ambiguity. Each type has its own structure, with Single Inheritance involving one superclass, Multi-Level involving a chain of inheritance, Hierarchical involving multiple subclasses from one superclass, and Hybrid combining different types.

Uploaded by

sasigandham34
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

Inheritance

Inheritance in Java is a concept that allows one class to acquire properties and behaviors from another class, similar to a parent-child relationship. There are four types of inheritance in Java: Single, Multi-Level, Hierarchical, and Hybrid, while Multiple Inheritance is not supported due to ambiguity. Each type has its own structure, with Single Inheritance involving one superclass, Multi-Level involving a chain of inheritance, Hierarchical involving multiple subclasses from one superclass, and Hybrid combining different types.

Uploaded by

sasigandham34
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

INHERITANCE

What is a inheritance in Java?

What is a inheritance in Java?


• Inheritance in Java is a concept that acquires
the properties from one class to other
classes; for example, the relationship between
father and son. Inheritance in Java is a process
of acquiring all the behaviours of a parent
object
What are the 4 types of inheritance
in Java?
• Single Inheritance.
• Multi-Level Inheritance.
• Hierarchical Inheritance.
• Hybrid Inheritance.
• Multiple Inheritance (not supported)
• Java does not support multiple inheritances due to ambiguity. For example, consider
the following Java program
Single Inheritance
• in single inheritance, a sub-class is derived from only
one super class. It inherits the properties and
behavior of a single-parent class. Sometimes it is also
known as simple inheritance.
Multi-level Inheritance
• multi-level inheritance, a class
is derived from a class which is
also derived from another class is
called multi-level inheritance. In
simple words, we can say that a
class that has more than one
parent class is called multi-level
inheritance.
Hierarchical Inheritance

• If a number of
classes are
derived from a
single base
class, it is
called hierarch
ical
inheritance.
Hybrid Inheritance
• In the above figure, GrandFather is a super class. The
Father class inherits the properties of the GrandFather
class. Since Father and GrandFather represents single
inheritance. Further, the Father class is inherited by the
Son and Daughter class. Thus, the Father becomes the
parent class for Son and Daughter.

You might also like