版权声明:歡迎转載 https://blog.csdn.net/jinjianghai/article/details/90377687
public MyThread extends Thread{
@Override
public void run(){
// 判断线程是否中断
while(!interrupted){
System.out.println("my thread");
}
}
public static void main(String args[]){
MyThread mythread = new MyThread();
// 启动线程
mythread.start();
// 线程线程,中断线程
mythread.interruted();
}
}