// Simple.java class MyThread extends Thread { @Override public void run() { for (int i = 0; i < 10; i++) { try { System.out.printf("In thread, i = %d.\n", i); Thread.sleep(1000); } catch (InterruptedException e) { System.out.printf("Interrupted!\n"); } } } } public class Simple { public static void main(String args[]) { MyThread t = new MyThread(); t.start(); for (int i = 0; i < 10; i++) { try { System.out.printf("In main, i = %d.\n", i); Thread.sleep(1000); } catch (InterruptedException e) { System.out.printf("Interrupted!\n"); } } } }