
414 CHAPTER 7 Object-Oriented Programming,Part 2: User-Defined Classes
13 Auto sporty = new Auto( "Spyder", 0, 0.0 );
14
15 System.out.println( "\nAfter instantiating an Auto object:"
16 + "\nthe count of Auto objects is "
17 + Auto.getCountAutos());
18 }
19 }
EXAMPLE 7.13 Auto Client,Version 6
Before instantiating an Auto object:
the count of Auto objects is 0
After instantiating an Auto object:
the count of Auto objects is 1
Figure 7.8
Output from Example
7.13
Well, there it is. We’ve finished defining our Auto class. Although it’s a large
class, we were able to build the Auto class incrementally using stepwise
refinement.
7.12 Graphical Objects
Let’s revisit ...