I know we can use depricated method 'stop()' to stop the thread.
But if I dont want to use any depricated method then how to kill a running thread??
There is a reason why stop() is deprecated. It is deprecated because when you force a thread to stop, instead of asking it to stop gracefully, you can leave variables in an indeterminate state -- as locks are forced to be released.
stop() is deprecated because there is no guaranteed safe way to force a thread to stop.