What is the difference between sleep and suspend ?

What is the difference between sleep and suspend ?

If the thread is not allowed to perform any operations for a particular period of time, then use sleep() method. The sleep() method suspends currently executing thread for the specified time.
Join()
The currently running thread is suspended until the invoking thread completes its execution (and entered into dead state). The currently executing thread joins at the end of the invoking thread. This is used when the currently executing thread cannot continue until the invoking thread completes its execution.

By:Sumit Tripathi
Date:2021-05-15 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher