There are also four additional objects created in lines 3 & 4 of m1() that also become eligible for garbage collection.
Even though the references to those objects (the ones created in lines 3 & 4) never go away, they become eligible because the references to the objects they are contained in go away, so no existing thread has access to them. Is this correct, or am I off here?
1)I want to know those instances of the class that are eligible for the garbage collection (mine answer is all the four).
Once thread A is notified isn't it possible for thread A to be blocked on B's lock for a short period of time until the synchronized code in B is finished executing. What am I missing here?
Please distinguish between the two calls, especially in the situation I have described above - unless, of course, the situation I described assumes something that is not correct.
But what then? As I have read, all of the waiting threads become 'runnable' which mean that they may be active within the synchronized block at the same time.