package examples; public class ex47b implements Runnable { public void run() { for(int i = 0; i < 20; i++) { System.out.println("" + i + ": " + Thread.currentThread().getName()); try { Thread.sleep((int)(Math.random() * 1000)); } catch(InterruptedException ie){ie.printStackTrace();} } System.out.println(Thread.currentThread().getName() + " done"); } public static void main(String[] args) { Thread one, two; one = new Thread(new ex47b(), "Rabbit"); two = new Thread(new ex47b(), "Turtle"); one.start(); two.start(); } }