Why do we use hierarchical inheritance in Java?

In Java, the class Object is at the top of hierarchy. Every class in Java inherits from Object and is-an Object. One of the main reasons to use an inheritance hierarchy is that the instance variables and methods from a superclass are inherited and can be used in a subclass without rewriting or copying code .

Sizin İçin Seçtik  Is HODL a good investment?

Leave a Reply

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