On page 155 the code goes as follows:
1)
String str = new String(Size =" + x);
2)System.out.println(str);
3)str = null; //string object eligible for garbage collection after line 3 is executed
Middle of page:
"Normally all objects created for local variables in a method becomes eligible for garbage collection when method exits"
So I'm left with 2 conflicting statements:
1) objects are eligible for garbage collection after its declared null
2) objects are eligible for garbage collection when the method returns
So am I misreading this chapter?
Can someone please shed some light?
Thanks in Advance!
Edmund