public class SimpleThread { public static void main(String[] args) { Thread thread1 = new Thread() { public void run() { int i = 0; while (i < 10) { System.out.println(++i); try { sleep(100); } catch (InterruptedException ie) { } } } }; Thread thread2 = new Thread() { public void run() { int i = 0; while (i < 10) { System.out.println(++i + 10); try { sleep(100); } catch (InterruptedException ie) { } } } }; thread1.start(); thread2.start(); } }