Inheritance in OOP: Reusing Code and Creating Class Hierarchies

In Java, inheritance in OOP allows one class (the subclass) to inherit the properties and behaviors (fields and methods) from another class (the superclass) with the help of extends keyword

 This mechanism supports the concept of “reusability” and “hierarchical classification.”

Inheritance in OOP is also known as IS-A relationship

In single inheritance, a class (subclass) inherits from a single superclass

In multilevel inheritance, a class inherits from another class, and then another class inherits from it, forming a chain of inheritance

Java does not support multiple inheritance directly through classes (i.e., a class cannot inherit from more than one class)