/** * Counter thread demo **/ class Counter extends Thread { public void run(){ for (int i=0; i<3; i++){ try { sleep(1000); } catch (InterruptedException ie) { } System.out.println("thread '" + getName() + "' says " + i + "."); } } }