Abstract Classes

 

class Boat extends Vehicle
{
  void turn(int angle) { ... }
}

 

An abstract class is one not intended for direct creation; creation is only implied as a general case of a more specific class.

 

Vehicle v;
v = new Vehicle();   wrong Vehicle is abstract
v = new Automobile();   ok
v = new Boat();         ok
Vehicle.java complete sample code.

 

 

Examples ObjectDraw.java (Run this applet.)

 

To Next Slide To Previous Slide To Contents