Welcome to Questionaries, where you can ask questions and receive answers from other members of the community.

Let us know at info@questionaries.org

What’s the difference between the methods sleep() and wait()?

5 like 0 dislike
What’s the difference between the methods sleep() and wait()?....

please give me for your feedback..............

Thanks in advance.................
asked 1 year ago by daneim (127,080 points)

1 Answer

1 like 0 dislike
 
Best answer
The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.
answered 1 year ago by marck_don (191,010 points)

Related questions

5 like 0 dislike
0 answers
5 like 0 dislike
1 answer
5 like 0 dislike
0 answers
1 like 0 dislike
0 answers
4 like 0 dislike
1 answer