Flat 10% & upto 50% off + Free additional Courses. Hurry up!

Inheritance (IS-A)


It is a process where one class takes the property of another class (parent class). The class which inherits the property of another class is known as sub class and the class whose property are inherited are known as super class.

Benefits of Inheritance

  • It provides code reusability
  • Run time polymorphism (Method Overriding) is achieved.



Keyword ‘extends’ is used to achieve inheritance.

class Subclass_name extends Superclass_name


//fields and methods



class Addition{

int sum;

public void total(int a, int b){

sum = a + b;

System.out.println("sum of two numbers:" +sum );



public class Arithmetic extends Addition{

int sub;

public void substraction(int i, int j){

sub = i - j;

System.out.println ("substraction of two numbers:" +sub);


public static void main(String args[]){

Arithmetic ar = new Arithmetic();

ar.total(10, 20);

ar.substraction(30, 20);




sum of two numbers:30

substraction of two numbers:10


Types of inheritance

Following are the types of inheritance:

  1. Single
  2. Multilevel – To reduce complexity it is not supported by java
  3. Hierarchical
  4. Multiple
  5. Hybrid

In java multiple and hybrid inheritance is supported through interface only.


inheritance types

Learn more about Cross-Platform Mobile Technology for Android and iOS using Java in this insightful blog now!

"0 Responses on Inheritance (IS-A)"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.


Sales Offer

  • To avail this offer, enroll before 28th October 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
DW offer

Sign Up or Login to view the Free Inheritance (IS-A).