Hi gents,
We all know that in order to invoke Object.wait() , this call must be placed in synchronized block,otherwise,IllegalMonitorStateException is thrown.But what's the reason for making this restriction?I know that wait() releases the monitor, but why do we need to explicitly acquire the monitor by making particular block synchronized and then release the monitor by calling wait() ?
What is the potential damage if it was possible to invoke wait() outside synch block, retaining it's semantics - suspending the caller thread ?
Thanks in advance