Why is the second answer correct? What exception was thrown and why?
P.S. Thanks for the answer!
Now I see that t1.wait()
shall be inside synchronized(t1)
- on t1, the same instance used to call wait(). Also this answer was helpful.
This is a free test taken from here