Say my class has a synchronized method and one
thread is executing the method. A second thread that tries to execute the same method has to wait until the first thread completes. Now, after the first thread is done executing the synchronized method, will the second thread be notified automatically? Or, do I have to explicitly notify() at the end of the synchronized method? If it happens automatically, then what purpose does the wait()/notify() mechanism serve?