Q:

How does Java's garbage collector work?

Possible Duplicate:
What is the garbage collector in Java? 

Within my program, I have a function set up that calls another function after a certain amount of time (we'll set it as 20 minutes for purposes of this example) using ScheduledThreadPoolExecutor.
The function that gets called, we'll say is removeStat(Character char). In the method, it makes references to functions in side character (we'll say char.getClient().getWriter()). We'll assume that during the 20 minute wait period, the character in question logs out and their Character instance is no longer required.
Would the Java garbage collector remove the Character class in that time, causing for the char in removeStat to be null, or does it know to wait until the call has been made?

A:

Garbage collectors (including Java's) are smart enough that you don't have to worry about this. The garbage collector won't garbage collect anything until all references to it have disappeared. If the object is still accessible, it still exists.

