interrupt a thread does not mean kill it . when you interrupt a thread and the thread invoke wait() just now , the thread will get a exception from wait(), so it can stop itself.you can add some wait() in you somemethod() and return at proper moment.
不会吧?????!!!!!!!!!!!!!!!!!!!
还有,这样的线程怎么杀?难道用stop?
Thread t = AddHere//your thread. if (t != null) {
t.interrupt();
}
t = null;
}
此方法能马上终止线程,由于可能产生非预知的结果,所以已经被sun声明废弃---还是可以用的。
还是非得用stop?