How do you avoid repeating code in Java?

1 answer

Answer

1101365

2026-08-15 14:15

+ Follow

By using Inheritance. By using Inheritance once class can re-use or inherit the features of another class.

Ex:

public class Ferrari extends Car {

...

}

Here, the class Ferrari reuses code/features of the class Car.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.