title: How to delete a class object?
body: <p>I have an object called CounterGUI. It creates a GUI. I create it in another class, say MyProgram.</p>
  
  <p>Once MyProgram creates a CounterGUI object, how do I delete the object? Say if I do this:</p>
  
  <pre><code>CounterGUI first = new CounterGUI(); //displays the GUI
  first = null;
  </code></pre>
  
  <p>I thought setting the object to null would delete everything (including the GUI), but it doesn't. How do I completely delete it?</p>
  
  <p>I don't see how this is a duplicate question, the previous answers were to set it to null or a new object, but that doesn't work here.</p>