Thanks Campbell and Henry for your quick replies.
Campbell, yes, I need to access aList outside this class and it is declared as a public field.
Henry, Just to make sure that I understand what you are saying.. Lets take this example.
I have an Order class:
Now I have a Product class:
Now I have my Test class that looks like this:
Now, since the old products are unreacheable, they should be available for GC. Is this correct?
Another example:
Everything is similar as above, except that now my Test class is a
Servlet. Once I add products to order object, I store order into a session. After setting order in a session I do aList = null;
What will happen in this case? The aList object will be available for GC, but the elements of aList are still referenced (stored in order object which is in a active session). So the products stored in aList will NOT be available for GC. Is my understanding correct?