Runnable r = new Runnable() { public void run() { try { Thread.sleep(1000) ; } catch (InterruptedException e) { System.out.printIn("interrupted"); } System.out.printIn("ran"); } }; Thread t = new Thread(r); t.start(); System.out.println("started"); t.sleep(2000); System.out.println("interrupting"); t.interrupt(); System.out.print In("ended");