Top Categories
8.5 Inheritance Example in Java Multi Level
- Category:
- Sub Category:
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of parent class, and you can add new methods and fields also. Inheritance represents the IS-A relationship, also known as parent-child relationship. In the terminology of Java, a class that is inherited is called a super class. The new class is called a subclass. Types of inheritance in java are: 1 simple/single level inheritance 2 multilevel 3 hierarchical