String s="abc"; s=s.concat("def"); In the above code, the object representing "abc" will become eligible for garbage collection or will stay in string pool.
A local variable lives only within the method that declared the variable. An instance variable lives as long as the object does.If the object is still alive,so are its instance variables.
Here the variable 's' is in scope only within its method.So 's' becomes eligible for garbage collection.
SADASIVAKUMAR UTTI, SCJP1.4
A bend in the road is not the end of the road ... unless you fail to make the turn.
"s" wont be eligible for garbage collection as its still pointing to new object which is created. "abc" will be eligible for GC, if we dont have any more reference in string pool referening to this.
GC runs only on the objects on the heap to make memory available as needed. "abc" is created in the string constact pool.GC does not run there. So "abc" will not be garbage collected.
As a side note garbage collection with strings is not in the exam.