Originally posted by lakshmi amulya:
Hi,
WHY in the following dode,thread does not exits ,when we call interrupt on it?
When you interrupt a thread... if the thread is executing wait(), sleep(), or join(), an InterruptedException will be thrown. For I/O operations, with some JVMs, you will get an IOException. For everything else, an interrupted flag will be set so that the thread can check it.
In your case, all your thread does is spin on the while loop. It's not executing anything that can generate an exception, and it's not check the flag to see if it has been interrupted.
Henry