What is Inheritance?

Inheritance means one class can extend to another class. So that the codes can be reused from one class to another class.

Existing class is known as Super class whereas the derived class is known as a sub class.

Example: 

Super class:

public class Manipulation{

}

Sub class:

public class Addition extends Manipulation{

}

Inheritance is applicable for public and protected members only. Private members can’t be inherited.

Top 50+ Java Interview Questions with Answers

We covered nearly 50 + primary Java interview questions in this tutorial for fresh and experienced candidates.  Q.1- What is… Read More

4 years ago