Interface vs Abstract Class

Interfaces and Abstract Classes both are the ways to achieve Abstraction in Java. Abstraction is the process to achieve something Abstract and Abstract means something which is not clear and if you are not clear about anything better put it in either Interfaces or Abstract Classes.

Though, Java 8 on wards there is not much difference remained between Interfaces and Abstract classes in java, as far as their usage is considered. But still lets talk about their differences.

If we need definition then we can say that: if two different classes, who cannot have same parent, share any functionality or feature then those methods are good candidates for an Interface instead an Abstract Class.

E.g.   Every Vehicle share number of common things between them


  • Engine,
  • Fuel Tank,
  • Brakes System,
  • Gear Box,
  • etc

So if we design any type of Vehicle class, like Car or Bike or Truck, we can put all above mentioned features into an Abstract Class. But if you notice they also share one more common functionality which is Exhaust System and as you now Vehicles are not the only thing that have Exhaust System. Generators also have Exhaust Systems. But Generators can not have Vehicle as their parent class.

So Exhaust System is a good candidate to go into an Interface instead an Abstract Class.


Hope this clears your doubt!!