The primary difference is that
Thread.sleep()pauses a thread for a fixed time without releasing any locks, whereasObject.wait()releases the object's lock and pauses the thread until another thread notifies it.
Loading…
The primary difference is that Thread.sleep() pauses a thread for a fixed time without releasing any locks, whereas Object.wait() releases the object's lock and pauses the thread until another thread notifies it.