Computer Science, asked by kushi2073, 1 year ago

how to block a running thread in java​

Answers

Answered by Jeniyaa
2

In today's Java version, You can stop a thread by using a boolean volatile variable. If you remember, threads in Java start execution from run() method and stop, when it comes out of run() method, either normally or due to any exception. You can leverage this property to stop the thread.

Hope it helps..

Similar questions