0 votes
3 views
in JAVA by (1.6k points)
The difference between sleep and wait in Java?

1 Answer

0 votes
by (4.8k points)

Though both are used to pause currently running thread, sleep() is actually meant for short pause because it doesn't release lock, while wait() is meant for conditional wait and that's why it release lock which can then be acquired by another thread to change the condition on which it is waiting.

Related questions

0 votes
2 views
asked Jan 27 in JAVA by rahuljain1 (1.6k points)
0 votes
8 views
asked Jan 27 in JAVA by rahuljain1 (1.6k points)
...