发布网友
共1个回答
热心网友
其中一个线程?使用类变量判断就可以了。
class A{
static boolean aStop = false;
static void test(){
new AThread().start();
while(! aStop){
}
System.out.println("AThread stoped.");
}
class AThread extends Thread{
public void run(){
/////////////////////////
aStop = true;
}
}
}