Hi Ash, Nachiket,
For the purpose of doing the mock exams, assume gc works on String literals (they all seem to be written that way
) .. which means you're right Ash, 1 object is eligible.
Two strings are created, "Test" and "Today". When string1 is set to 'null' the object "Test" is no longer being referenced. string2 references "Today"; so when string1 is set to equal string2 it will also be pointing to the string object "Today".
Remember that on the exam you probably will only get 1 question on gc and it not apt to involve String literals. The key is to understand how reference type variables work vs primitive variables and that a reference variable set to 'null' no longer points to any object.
Hope that helps.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform