Two threads executing synchronized block simultaneously

Solution 1:

The answer lies in java.lang.Object.wait(long) whose documentation says:

[...] This method causes the current thread (call it T) to place itself in the wait set for this object and then to relinquish any and all synchronization claims on this object. [...]

Solution 2:

Use

Thread.sleep(5000);

JavaDocs for Thread.sleep:

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors.