What is Inheritance?

Inheritance is one of the features of Object Oriented Programming.

This feature allows emulating real world inheritance behavior. This is one of the best features to avoid reuse of the code and increase redundancy.

In the Java language, classes can be derived from other classes, thereby inheriting fields and methods from those classes.

“A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a super class (also a base class or a parent class).”

Except Object, which has no superclass, every class has one and only one direct superclass (single inheritance). In the absence of any other explicit superclass, every class is implicitly a subclass of Object.

The idea of inheritance is simple yet powerful:

Let us take a Scenario:

When you want to create a new class and there is already a class that includes some of the code that you want (which is functionally same), you can derive your new class from the existing class. By doing this, you can reuse the fields
and methods of the existing class without having to write (and debug!) them yourself.

Here I have introduced you to one of the important feature used in Java.

For detailed explanation with example you can refer:
http://java.about.com/od/objectorientedprogramming/a/inheritance.htm

If you are interested in learning Java online with a real time expert and choose your profession as a Java developer, please register with us.

For more details about the course content, Visit :
Java Online Training Course