Page 320 - Introduction to Programming with Java: A Problem Solving Approach
P. 320

                286 Chapter 7 Object-Oriented Programming—Additional Details
§7.7 Overloaded Methods
10. What is it called when you have two or more methods with the same name in the same class?
11. If you want the current object to call a different method in the same class as the current class, the method
call is easy—just call the method directly, with no reference variable dot prefix. (T / F)
§7.8 Constructors
12. What is the return type of a constructor?
13. The name of a constructor must be exactly the same as the name of its class. (T / F)
14. Standard coding conventions suggest that you put constructor definitions after the definitions of all
methods. (T / F)
§7.9 Overloaded Constructors
15. If a class’s source code contains a single one-parameter constructor, the constructor is overloaded
because this one-parameter constructor has the same name as the default zero-parameter constructor.
(T / F)
16. Suppose you have a class with two constructors. What are the rules for calling one constructor from the
other constructor?
§7.10 Problem Solving with Multiple Driven Classes
17. You can partition a large problem into many smaller problems by using many driven classes. (T / F)
18. How do you give a component object a reference to its container or another component in the same
Exercises
1. [after §7.2] Given a Car class with these two instance variables: String make;
int year;
Describe all the operations that occur when this statement executes:
Car caidenCar = new Car();
2. [after §7.3] Trace the Car program shown in Figures 7.2 and 7.3. Use the following trace setup. Note that we have used abbreviations to keep the trace’s width as small as possible.
container?
19. What do you do to make one object logically contain another object?
Apago PDF Enhancer
    CarDriver
Car
                               line#
jCar
main
sCar
line#
setMake
make
setYear
this
year
setColor
this
color
makeCopy
this
car
disp
this
make
obj1
year
color
make
obj2
   this
year
color
output
  3. [after §7.3] What is garbage collection?








































   318   319   320   321   322