Java中的线程的唤醒Thread.interrupt()

class MyThead implements Runnable
{
	public void run()
	{
		System.out.println("我休息了!");
		try
		{
			Thread.sleep(1000);
		}
		catch (InterruptedException e)
		{
			System.out.println("啊,这么早就把我叫起来了!");
		}
	}
}

public class TheadMain
{
	public static void main(String[] args)
	{
		MyThead myThead = new MyThead();
		Thread thread = new Thread(myThead);
		thread.start();
		thread.interrupt();
	}
}

你可能感兴趣的:(Java中的线程的唤醒Thread.interrupt())