Difference between sleep() and wait() in Java?

Java sleep () and wait ()

The major difference is that wait () releases the lock or monitor while sleep () doesn't releases the lock or monitor while waiting. wait () is used for inter-thread communication while sleep () is used to introduce pause on execution, generally.

Comments