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

Popular posts from this blog

Fixed Windows warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)

How to install/renew SSL Certificate for Glassfish