posted 15 years ago
As Deepak said, that the answer would be that the wait call will wait forever in the second code (from exam point of view). But the specific examples that you gave in that other topic, both the codes might keep waiting forever.
In this code, the run method might get the lock over ThreadB object before the main method, so the call to wait in the main method might never return. Same is with the second code. So for the first code, the output is unpredictable (output can be 45 or the program could wait forever) and for the second code, the output is that the program will wait forever...