
446 CHAPTER 7 Object-Oriented Programming,Part 2: User-Defined Classes
EXERCISES,PROBLEMS, AND PROJECTS
ence is used as a String and its job is to provide a printable repre-
sentation of the object data.
■
The equals method compares two objects for equality, that is, it
should return true only if the corresponding instance variables in
both objects are equal in value, and false otherwise.
■
Static class variables are created when the class is initialized. Thus,
class variables exist before any objects are instantiated, and each
class has only one copy of the class variables. Static variables that
are constants are usually declared to be public because ...