In this post, we will see the difference between wait() and sleep() method in Java.
|sleep() Method||wait() method|
|The sleep() method is defined in Thread class.||The wait() method is defined in the Object class.|
|sleep() is a static method.||wait() is a non static method.|
|We can't notify any thread while sleep time.||We can notify any thread while waiting time.|
|For sleep() method it is not mandatory to call in Synchronized context.||In case of wait() method it must need to call in synchronized context.|