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();
}
}
多线程-继承 Thread 线程中断
最新推荐文章于 2023-05-22 14:50:03 发布