Answer Posted / kruthi
stop(), suspend() and resume() are the methods used for
thread implementation.
stop() - terminate the thread execution,
Once a thread is stopped, it cannot be restarted with the
start() command, since stop() will terminate the execution
of a thread. Instead you can pause the execution of a
thread with the sleep() method. The thread will sleep for a
certain period of time and then begin executing when the
time limit is reached. But, this is not ideal if the thread
needs to be started when a certain event occurs. In this
case, the suspend() method allows a thread to temporarily
cease executing.
resume() method allows the suspended thread to start again.
Is This Answer Correct ? | 77 Yes | 3 No |
Post New Answer View All Answers
What is the static import?
Why are getters and setters used?
What is a dynamic array in java?
If we don’t want some of the fields not to serialize how to do that?
What is double in java?
What is the purpose of garbage collection in java, and when is it used?
What is garbage collection? What is the process that is responsible for doing that in java?
What is lazy programming?
Can we declare an array without size in java?
How does class forname work in java?
Can we create a constructor in abstract class?
Can java hashmap have duplicate keys?
What is class forname used for?
What are the differences between processes and threads?
What is empty string literal in java?