Java Reference
In-Depth Information
Note the use of the protected access modifier on the decodeColor method.
By making this method protected it can be accessed in the current class
or in a subclass but is not externally visible. We look in detail at what
protected access really means on page 93 .
Exercise 3.1 : Starting with the Vehicle class from the exercises in
Chapter 2 , create an extended class called PassengerVehicle to add a
capability for counting the number of seats available in the car and the
number currently occupied. Provide a new main method in PassengerVe-
hicle to create a few of these objects and print them out.
 
Search WWH ::




Custom Search