Chapter 2 Review Exercise Solutions
An object contains state information. An object reference describes the location of an
An object contains state information. An object variable contains an object reference, that
is, the location of an object.
An object is a value that can be created, stored, and manipulated. A class is a
programmer-defined data type that describes objects with the same behavior.
new Rectangle(5, 10, 20, 30); // Object
Rectangle box; // Object variable
In the Java programming language, the = operator denotes an action, to replace the value
of a variable. This usage differs from the traditional use of the = symbol as a statement
new Rectangle(75, 75, 50, 50)
Rectangle square = new Rectangle(75, 75, 50, 50);
String greeting = "Hello, Dave!";
Rectangle square = new Rectangle(10, 20, 40, 40);
square = new Rectangle(20, 20, 40, 40); // replaces with a new object
Rectangle square1 = new Rectangle(20, 20, 40, 40);