How do you stop a thread in java?
Answer / Pushpendra Arya
To stop a thread in Java, you can use one of the following methods: (1) Call the interrupt() method on the Thread object. This sets the interrupted status flag for the thread and can be checked using the interrupted() method. (2) Have the thread check a volatile boolean flag periodically and terminate itself when the flag is set to true.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is parameters example?
Why hashcode is used in java?
can java object be locked down for exclusive use by a given thread? Or what happens when a thread cannot acquire a lock on an object? : Java thread
Difference between the String and StringBuffer classes?
Is linked list a linear or non-linear data structure?
1 Answers Akamai Technologies,
Where will it be used?
What is set in java?
In how many ways we can create threads in java?
What are the three parts of a lambda expression?
How do you find the maximum number from an array without comparing and sorting?
What are the advantages of java over cpp?
what is Inheritense