What is inheritance in Java with real life example?

Inheritance is the capability of one class to inherit capabilities or properties from another class in Java . For instance, we are humans. We inherit certain properties from the class ‘Human’ such as the ability to speak, breathe, eat, drink, etc. We can also take the example of cars.

Sizin İçin Seçtik  How do you call a constructor of superclass in subclass?

Leave a Reply

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