public class GrisGrop4 { public static void main(String[] args) { // Create two instances of StringPrinter. Runnable grisGrop = new StringPrinter("GrisGrop", 95); Runnable blorp = new StringPrinter("Blorp", 111); // Create two threads, each having an instance // of StringPrinter as its "resident Runnable". Thread grisGropThread = new Thread(grisGrop); Thread blorpThread = new Thread(blorp); // Start both threads grisGropThread.start(); blorpThread.start(); // Wait for both threads to finish. join(grisGropThread); join(blorpThread); // Print a goodbye message. System.out.println("Goodbye."); } /* Applies join() to the given thread, catching ** InterruptedException if it is thrown. */ private static void join(Thread t) { try { t.join(); } catch (InterruptedException e) { e.printStackTrace(System.out); } } }