例 11-5
public class xyz implements Runnable{
…… // 执行线程的主要操作
}
public class ThreadTest{
public static void main(String args[]){
Runnable r = new xyz();
Thread t = new Thread(r);
t.start();
// 相应的操作
if (time_to_kill){
t.stop();
}
}
}
public class xyz implements Runnable{
…… // 执行线程的主要操作
}
public class ThreadTest{
public static void main(String args[]){
Runnable r = new xyz();
Thread t = new Thread(r);
t.start();
// 相应的操作
if (time_to_kill){
t.stop();
}
}
}