In above code i am trying to call notify method in user object without acquiring the lock of the user class. Since you have only lock in current class due to this illegalmonitorstateexception being raised. In order to over come this issue first get into the lock of the class by using synchronization then call the methods.