next up previous
Next: Lab Exercise 5: Paying Up: In the Laboratory: CyberPetApplet Previous: Lab Exercise 3: Paying

Lab Exercise 4: Tracing the Applet

CyberPetApplet inherits a number of methods from its superclasses. The main ones are

In addition to the above methods, which are inherited from Applet, our applets implement the ActionListener interface, so they also inherit the following method, which must be redefined in the applet.

Of these methods, CyberPetApplet redefines init() and implements actionPerformed(). Definitions for the other methods don't appear in CyberPetApplet.

Place a System.out.println("In method X") statement, where X is the name of the method, in each method of both the CyberPetApplet and CyberPet classes. Run the program and note the output that it produces. Write down the order of execution of the statements in CyberPetApplet and CyberPet for various actions, such as clicking on the eat button or the sleep button.


next up previous
Next: Lab Exercise 5: Paying Up: In the Laboratory: CyberPetApplet Previous: Lab Exercise 3: Paying
Ralph Morelli {Faculty}
12/22/1999