They are both related to multithreading.
- wait() from Object class and sleep() from Thread class.
- While both of them are idle, wait will release the lock of object but sleep() won’t
总结一下:
wait()-from Object class-release the lock while wait
sleep()-from thread class-hold the lock while wait