FileDocCategorySizeDatePackage
InterruptTest.javaAPI DocExample515Sun Jul 13 15:31:00 BST 1997None

InterruptTest

public class InterruptTest extends Object implements Runnable

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		Thread sleepyThread = new Thread( new InterruptTest() );
		sleepyThread.start();

		Thread.sleep(500);
		sleepyThread.interrupt();
		Thread.sleep(500);
		sleepyThread.interrupt();
	
public voidrun()

		while ( true ) {
			try {
				System.out.println("Sleeping...");
				Thread.sleep( 1000*1000 );
			} catch ( InterruptedException e ) {
				System.out.println("interrupted...");
			}
		}