OOPS – Inheritance

Inheritance is used for code-reusability. Inheritance is a mechanism wherein a new class is derived from an existing class. In Java, classes may inherit or acquire the properties and methods of other classes. A class derived from another class is called a subclass, whereas the class from which a subclass is derived is called a superclass.

1. Dog Class

2. Fish Class

3. Animal Class

4. Runner Class

Please share your feedback and share the post. Contact us at online.nimit@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *