There is only one question on Garbage Collection, so it's all or nothing.
RHE, at best, glosses over Garbage Collection, leaving the student with the idea that "you can't force garbage collection" being the only objective of the exam. Wrong. You MUST know when objects are available for collection...
Example:
Where is the object initially referenced by arg1 eligible for collection?
*After* line 9. The key is that msg holds a reference to arg1. When arg1 is nulled on line 8, it can't be GC'd because of this reference. Only on line 9 is this reference replaced with a new
String by concat'ing the other Strings.
Hope this helps.
Tim
Timothy Stone, MIT, SCJP
http://www.petmystone.com/
"This Satan's drink [coffee] is so delicious, we shall cheat Satan and baptize it." --Pope Clement the VIII (1592-1605)