408 Object-Based Programming Chapter 8 Fig. 8.9 Using (Web server hosting)
408 Object-Based Programming Chapter 8 Fig. 8.9 Using class Time3 s set and get methods (part 4 of 4). Note that when the Add 1 to second button is clicked, method actionPerformed calls the applet s tick method (defined at lines 108 118). Method tick uses all the new set and get methods to increment the second properly. Although this works, it incurs the performance burden of issuing multiple method calls. In Section 8.12, we discuss the notion of package access as a means of eliminating this performance burden. Common Programming Error 8.8 A constructor can call other methods of the class, such as set or get methods. However, the instance variables might not yet be in a consistent state, because the constructor is in the process of initializing the object. Using instance variables before they have been initialized properly is a logic error. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/3/01