Hello,
Please can someone help me clear up exactly how garbage collection works. I know it can't be forced, i know it runs in a low priority
thread. I have created a mock question in which i cant work out when exactly the object ao becomes eligible for collection:
1 public void testMethod() {
2 AnObject ao = new AnObject();
3 AnObject other = new AnObject();
4 other = ao;
5 ao = null;
6 System.out.println("Other "+other);
7 }
Does ao become eligible after line 5 or when the method returns, or is it elsewhere...
Please help!