/* * File: TestCyberPetApplet.java * Author: Java, Java, Java * Description: This applet serves as a user interface to the * CyberPet. It creates two CyberPets and "orders" them to eat * and sleep. This applet must be run with a browser. */ import java.applet.*; public class TestCyberPetApplet extends Applet { public void init() { // Execution starts here System.out.println("init() is starting"); CyberPet pet1; // Declare two references CyberPet pet2; pet1 = new CyberPet(); // Instantiate the references pet2 = new CyberPet(); // by creating new objects pet1.sleep(); // Tell pet1 to sleep. pet1.eat(); // Tell pet1 to eat. pet2.sleep(); // Tell pet2 to sleep. System.out.println("init() is finished"); return; // Return to the system } // init() } // TestCyberPetApplet