0 votes
in JAVA by
If a thread goes to sleep

a) It releases all the locks it has.

b) It does not release any locks.

c) It releases half of its locks.

d) It releases all of its lock except one.

1 Answer

0 votes
by

(b) It does not release any locks.

Reason: The sleep() method does not release any locks of an object for a specific time or until an interrupt occurs. It leads to the poor performance or deadlock of threads. Whereas, the wait() method does not release the locks of an object.

Therefore, when a thread goes to sleep, it does not release any locks.

Related questions

0 votes
asked Apr 9, 2021 in JAVA by Robindeniel
0 votes
asked Apr 8, 2021 in JAVA by SakshiSharma
...