How inheritance supports reusability?

Java Programming Language >   Inheritance in java >   Inheritance in Java (IS-A)  

Short Question

3137


Answer:

Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of the parent object. Using inheritance, we can create a general class that defines traits common to a set of related items. This class can then be inherited by other, more specific classes, each adding those things that are unique to it.

Java strongly supports the concept of reusability. The Java classes can be reused in several ways. Once a class has been written and tested, it can be adapted by another programmer to suit their requirements. This is basically done by creating new classes, reusing the properties of the existing ones. The logic behind inheritance in Java is that we can create new classes that from existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class, and you can add new methods and fields also. That


This Particular section is dedicated to Question & Answer only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.