Stopping Threads
Hi,
I wanted to stop some threads but the code below is an example of how it is not working. Are the threads interrupting themselves when I call interrupt() ? Does this mean if you want to stop a thread, it has to stop itself?
Thanks,
Michael
publicclass Test{
publicstaticvoid main(String[] args){
new Test().run();
}
publicvoid run(){
Thread a =new Test().new T();
Thread b =new Test().new T();
a.start();
b.start();
a.interrupt();
b.interrupt();
}
class Textends Thread{
publicvoid run(){
while(true){
System.out.println(this.getName());
}
}
}
}

