Java Reference
In-Depth Information
meter as above. Some object-oriented languages advocate per-object
access control, but the Java programming language is not one of them.
Exercise 2.13 : Make the fields in your Vehicle class private , and add
accessor methods for the fields. Which fields should have methods to
change them, and which should not?
Exercise 2.14 : Make the fields in your LinkedList class private , and add
accessor methods for the fields. Which fields should have methods to
change them, and which should not?
Exercise 2.15 : Add a changeSpeed method that changes the current
speed of the vehicle to a passed-in value and add a stop method that
sets the speed to zero.
Exercise 2.16 : Add a method to LinkedList to return the number of ele-
ments in a list.
 
Search WWH ::




Custom Search