Java IS-A relationship

Java – Inheritance Basics :

No Term Definition
1 Inheritance Inheritance is a process where one object acquires the properties of another object
2 Subclass Class which inherits the properties of another object is called as subclass
3 Superclass Class whose properties are inherited by subclass is called as superclass
4 Keywords Used extends and implements

IS-A Relationship with Example :

IS-A is a way of saying : This object is a type of that object.

public class Vehicle{

public class FourWheeler extends Vehicle{

public class TwoWheeler extends Vehicle{

public class WagonR extends FourWheeler{

Conclusions from above Example :

From the above example we can say that –

  1. Vehicle is the superclass of TwoWheeler class.
  2. Vehicle is the superclass of FourWheeler class.
  3. TwoWheeler and FourWheeler are sub classes of Vehicle class.
  4. WagonR is the subclass of both FourWheeler and Vehicle classes.


IS-A relationship of above example is –

TwoWheeler  IS-A Vehicle
FourWheeler IS-A Vehicle
WagonR 	    IS-A FourWheeler


WagonR 	    IS-A Vehicle