Hi all,
This seems to be a pretty simple question, got it from Jargon's
applet but the answer given doesn't match with mine, can somebody help??
At what point is the object anObj available for garbage collection.
01: public class Base{
02:
03: private void
test() {
04:
05: if(true) {
06:
String anObj = "sample";
07: String locObj = anObj;
08: anObj.trim();
09: anObj = null;
10: locObj.trim();
11: }
12: }
13:
14: static public void main(String[] a) {
15: new Base().test();
16: }
17:
18: }
Select most appropriate answer
a) After line 7
b) After line 8
c) After line 9
d) After line 10
e) After line 11
My answer is c while the answer given is e.