What is the use of reusability in inheritance?

1 answer

Answer

1022138

2026-07-16 22:05

+ Follow

Java
Java

Inheritance in Java refers to the feature wherein the code/functionality of one class can be used in another class that extends this class. Example:

public class Parent {

...

..

}

public class Child extends Parent {

...

..

.

}

Here the class Child extends the class Parent and hence the methods of Parent are available for Child to use. This way we are re-using the code in the parent class in the child class instead of re-writing the whole thing again.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.