When a task invokes yield( ), it changes from running state to runnable state.
When a task invokes sleep ( ), it changes from running state to waiting/sleeping state.
The method wait(1000), causes the current thread to sleep up to one second. A thread could sleep less than 1 second if it receives the notify( ) or notifyAll( ) method call.
The call to sleep(1000) causes the current thread to sleep for 1 second.