- Wait() must be called in synchronization context, otherwise IllegalMonitorStateException thrown.
- wait operates on Object and defined in Object class while sleep operates on current Thread and defined in java.lang.Thread class.
- Wait() method releases the lock it holds, where as sleep method not.
- Sleep is static method, where as wait is non static.
Related links
Home
No comments:
Post a Comment