Easy learning with example program codes

Why inheritance is used?

Inheritance is a way to implement IS-A relationship i.e. parent child relationship. Subclass inherits the super class properties like data member, methods. Inheritance is the way of re-usability of code. Let us take the example of parent and child. A child inherits the properties of its parent.

Why inheritance is used?

  1. Code re-usability.
  2. Run-time polymorphism.


class subclass extends superclass{

 //subclass code



Java nterview questions on inheritance

Please follow and like us:

Copyright © 2020 CodesJava Protection Status