what is the difference between wait() and sleep() methods in thread class?
1) wait()is a Object class method whereas sleep() is a thread class method.
2)The sleep method sends the current thread into Non-Runnable state for the specified amount of time but it doesn't cause the thread to loose ownership of the acquired monitors.The wait() method also sends the current thread into Non-Runnable state like the sleep() method but wait() method, the locks are released before going into Non-Runnable state, so that any other thread that is waiting on the object can use it.
3)Sleep method will not release the lock after completion of time but wait method does.
For more information, visit the following links: