Thread sleepyThread = new Thread( new InterruptTest() ); sleepyThread.start(); Thread.sleep(500); sleepyThread.interrupt(); Thread.sleep(500); sleepyThread.interrupt();
while ( true ) { try { System.out.println("Sleeping..."); Thread.sleep( 1000*1000 ); } catch ( InterruptedException e ) { System.out.println("interrupted..."); } }