What is stop(), suspend(), resume() method?

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


Please Help Members By Posting Answers For Below Questions

What is the static import?

591


Why are getters and setters used?

569


What is a dynamic array in java?

565


If we don’t want some of the fields not to serialize how to do that?

565


What is double in java?

514






What is the purpose of garbage collection in java, and when is it used?

562


What is garbage collection? What is the process that is responsible for doing that in java?

656


What is lazy programming?

565


Can we declare an array without size in java?

524


How does class forname work in java?

480


Can we create a constructor in abstract class?

571


Can java hashmap have duplicate keys?

511


What is class forname used for?

540


What are the differences between processes and threads?

517


What is empty string literal in java?

562