How inheritance supports reusability?

Long Answer
Views 3157

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

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.