/* * Example of using threads */ import java.io.IOException; public class SleepyTest { public static void main(String []args) { Sleepy sleepy1 = new Sleepy("Bob"); Sleepy sleepy2 = new Sleepy("Alice"); System.out.println("Starting sleepy threads. Press Enter to quit."); sleepy1.start(); sleepy2.start(); // wait for user input try { System.in.read(); } catch (IOException e) {} sleepy1.terminate(); sleepy2.terminate(); } }