Flat 10% & upto 40% off + 10% Cashback + 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();, 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)"

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

Sales Offer


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