帮忙看下程序为什么不能实现interrupt方法?在线求大神解答
import java.util.*;
public class TestSleep
{  
	public static void main(String[] args)  
	{
		Run r = new Run();
		Thread t = new Thread(r);
		t.start();
		try{Thread.sleep(10000);}
		catch(InterruptedException e){
			t.interrupt();
		}
	}
}
class Run implements Runnable
{	
	boolean flag = true;
	public void run(){
		while(flag){
			try{Thread.sleep(1000);}catch(InterruptedException e){return ;}
		System.out.println("------"+ new Date()+ "-----");
		}
	}
}
------解决方案--------------------
主程序的 t.interrupt(); 放错位置了,不能放在catch中,应该移动到括号外面去。