INHERITANCE JAVA
INHERITANCE JAVA
Increased Complexity
Overriding Can Lead to Unexpected Behavior
Types of Inheritance in Java
In single inheritance, a
sub-class is derived
from only one super
class. It inherits the
properties and behavior
of a single-parent class
MULTILEVEL INHERITANCE
In the image:
Class A is the base (parent) class.
Class B and Class C both inherit from Class A.
Then, Class D and Class E inherit from Class B,
and Class F and Class G inherit from Class C.
So, one parent class (Class A) gives its
properties to many child classes, forming a tree-
like structure.
OVERRIDING