A thread terminates when its run method returns. In JDK 1.0, there also was a stop method that another thread could call to terminate a thread. However, that method is now deprecated. We discuss the reason on page 46.
There is no longer a way to force a thread to terminate. However, the interrupt method can be used to request termination of a thread.
When the interrupt method is called on a thread, the interrupted status of the thread is set. This is a Boolean flag that is present in every thread. Each thread should occasionally check whether it has been interrupted.
To find out whether the interrupted status was set, first call the static Thread.currentThread method to get the current thread and then call the isInterrupted ...