Monday, December 3, 2012

Why there is a need of Abstract class in Java

Many developers think that Abstract class is a class which can not be instantiated, but can be extended into subclasses. that is whose object can not be created, but there is more to it

Why we need an abstract class?
Abstract class does not have any real time object, but it is required to provide some common characteristics
Example Vehicle - Car, truck,
Car - Maruti, Hyundai, tata Nano

Vehicle is the abstract class, it has tires and steering, car has 4 tyres , truck has 6 or 8 tyres
Car is abstract class, it has tires, steering, dashboard, headlight etc.


No comments:

Post a Comment