3. INDEX
➢ What is Inheritance?
➢ Types of Inheritance
○ Single Inheritance
○ Multi-level Inheritance
○ Hierarchical Inheritance
○ Multiple Inheritance
○ Hybrid Inheritance
➢ Multiple Inheritance in java
4. What is Inheritance?
Inheritance in Java is a mechanism in which one object acquires all
the properties and behaviors of a parent object. It is an important
part of OOPs.
Inheritance represents the IS-A relationship which is also known
as a parent-child relationship.
5. Types of inheritance in java
Class A
Class B Class C
Class B
Class A
Class C
Class A
Class B
1. Single
2. Multi-Level
3. Hierarchical
6. ** Multiple inheritance is not supported in Java through class.
Class A Class B
Class C
Class D
Class A Class B
Class C
4. Multiple
5. Hybrid
7. Single Inheritance Example
Base Class: Father
Derived Class: Child
Child class can
access the method
honest() from Father
class.
But Father class can
not access the
method patience().
9. Hierarchical Inheritance Example
Base Class: Father
Derived Class: Child1
Derived Class: Child2
Child1 & Child2 both
classes can access the
method honest() from
Father class.
10. Why multiple inheritance is not supported in java?
❏ To reduce the complexity and simplify the language,
multiple inheritance is not supported in java.
❏ Consider a scenario where A, B, and C are three classes. The
C class inherits A and B classes. If A and B classes have the
same method and you call it from child class object, there
will be ambiguity to call the method of A or B class.
11. If you inherit 2 classes. So whether you have same method or different, there will be
compile time error.