saurabhmehta mehta wrote:I guess since the other thread has not yet released the lock due to sleep() method.
You guessed correctly. The thread you want to notify needs to own the lock to be notified.
saurabhmehta mehta wrote:So is the notify() call being made only after the entire loop is over?
The call on notifiy() is made several times in the DemoThread. But the call only has an effect on the notified thread when it gets the lock.