我启动一个线程,然后向中断它,但是中断不了,一直运行。求解。
public class Test2 { /**
 * @param args
 * @throws InterruptedException
 */
public static void main(String[] args) throws InterruptedException {
Thread t = new Thread(new T());
t.start();
Thread.sleep(3000);
t.interrupt();
}}class T extends Thread { @Override
public void run() { while (true) {
if (this.isInterrupted()) {
System.out.println("被打断了");
break;
}
System.out.println("running");
}
}
}