How to kill a thread?

This question is related to Oracle Interview

Showing Answers 1 - 1 of 1 Answers

The Thread.stop() method can be used to kill a thread but it is unsafe and thus deprecated.
Other way would be to have a variable indicating if the thread should be stopped. Other threads may set the variable to make the thread stop. Then, the thread itself may clean up and stop.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions