Inheritance -
- inheritance in Java is a mechanism in which one object acquires all properties and behaviors of parent object.
- The idea behind inheritance in Java is that you can create new class 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.
Note- Inheritance represent the IS-A relationship, also know as parent -child relationship.
Why use inheritance in Java -
- For Method Overriding (so Runtime Polymorphism can be achieved)
- For code Reusability.
- Inheritance can be defined as the process where one class acquires the properies (methods and field) of another. With the use of inheritance the information is made manageable in a hierarchical order.
- The class which inherits the properties of other is now as subclass (derived class, child class) and the class whose properties are inherited is known as superclass (base class, parent class).
- Types of inheritance
https://Erhsmathur. blogspot.com
Thanks you sir note mujhe pasand hai
ReplyDeleteThanks sir
ReplyDeleteBahut bhadiya sir ji
ReplyDeleteBhadiya sir ji
ReplyDelete