When
notify() is reached, the
thread waiting on that object will be notified (
ThreadA in this case).
So ThreadA will be moved into the pool of live threads, but it won't be running until ThreadB has finished;
this is because ThreadB hasn't released the lock yet and ThreadA needs
b's lock before moving to
System.out.println("waiting done") which is contained in a block synchronized on
b.