title: How does Java's garbage collector work?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3798424/what-is-the-garbage-collector-in-java">What is the garbage collector in Java?</a>  </p>
  </blockquote>
  
  
  
  <p>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 <code>ScheduledThreadPoolExecutor</code>.</p>
  
  <p>The function that gets called, we'll say is <code>removeStat(Character char)</code>. In the method, it makes references to functions in side character (we'll say <code>char.getClient().getWriter()</code>). We'll assume that during the 20 minute wait period, the character in question logs out and their Character instance is no longer required.</p>
  
  <p>Would the Java garbage collector remove the <code>Character</code> class in that time, causing for the char in <code>removeStat</code> to be null, or does it know to wait until the call has been made?</p>