ch02ExSol - Chapter 2 Review Exercise Solutions R2.1 An...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 2 Review Exercise Solutions R2.1 An object contains state information. An object reference describes the location of an object. R2.2 An object contains state information. An object variable contains an object reference, that is, the location of an object. R2.3 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. R2.4 new Rectangle(5, 10, 20, 30); // Object Rectangle box; // Object variable R2.5 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 about equality. R2.6 new Rectangle(75, 75, 50, 50) "Hello, Dave!" R2.7 Rectangle square = new Rectangle(75, 75, 50, 50); String greeting = "Hello, Dave!"; R2.8 Rectangle square = new Rectangle(10, 20, 40, 40); square = new Rectangle(20, 20, 40, 40); // replaces with a new object R2.9 Rectangle square1 = new Rectangle(20, 20, 40, 40);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/07/2010 for the course JAVA 153 taught by Professor Silou during the Spring '10 term at Golden West College.

Page1 / 3

ch02ExSol - Chapter 2 Review Exercise Solutions R2.1 An...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online