First of all thanks for your answers.
wait() releases the lock so that some other thread can grab the lock, do whatever the original thread is waiting for
1. so, only when the current thread is waiting for some other thread's execution, the wait() method is called?
2. so the method wait() waits till the current thread gets a notification?
3. if it doesn't get notified, it will keep waiting?
4. when a thread says notify() there is no guarantee that the thread which we are expecting will get notified right? so if the original thread gets a notify from some other unexpected thread, the original thread may run before the 'other thread'(which it is waiting for to finish some operation) finishes operation right? so what is the point in saying wait()?
to explain thread A is saying wait() expecting B to say notify(). what if some other thread C says notify() before B says notify() and A gets notified?
ARUL JOSE