Labs

In this lab we will change our subclasses to use features of their superclasses.

This set of labs is short, but will be used in subsequent chapters to use other features of object-oriented programming.

  1. Change Automobile, Truck, and Boat to pass arguments to parent class constructors using super(). Remove any calls to setters.
  2. Remove no-arg constructors from Vehicle, Automobile, Truck, and Boat. Now when a user creates an instance of these classes, the user must supply all data.
  3. Fix any compilation errors, and run VehicleTestApp to verify your classes still work.

(Solution: Vehicle3.java, Automobile3.java, Truck3.java, Boat3.java, VehicleTestApp3.java)


Prev -- Up