Originally posted by jianfeng shi: and whether it's print "XY" with a 1 second delay between X and Y.

Well, this question will definitely *not* appear on the test, because you need implementation knowledge to answer this.

First, whether there will be a delay or not... it actually depends. The lib actually uses the Thread object to implement the join() method. So...

If the main thread grabs the lock (so it can wait), before the run() method of the new thread finishes and signals to that it finished, then the wait() method will receive the notification and return immediately.

On the other hand, if the new thread finishes and signals it completion, before the main method grabs the lock, then the main method will wait.

Second, in the example, no thread is sending the interruption, so "Y" should not even be printed.