Put answers on blog or Google document before next class (Monday). Questions on page 74.
Exercise R2.1.
Explain the difference between an object and an object reference.
Exercise R2.2.
Explain the difference between an object and an object variable.
Exercise R2.3.
Explain the difference between an object and a class.
Exercise R2.4.
Give the Java code for constructing an object of class Rectangle, and for declaring an object variable of class Rectangle.
Exercise R2.5.
Explain the difference between the = symbol in Java and in mathematics.
Exercise R2.6.
Uninitialized variables can be a serious problem. Should you always initialize every int or double variable with zero? Explain the advantages and disadvantages of such a strategy.
Exercise R2.7.
Give Java code to construct the following objects:
(a)
A rectangle with center (100, 100) and all side lengths equal to 50
(b)
A string “Hello, Dave!”
Create objects, not object variables.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment