title: Garbage collection when application ends
body: <p>As far as I know objects are available to be garbage collected when assigning a null value to the variable : </p>
  
  <pre><code>Object a = new Object;
  a = null; //it is now available for garbage collection
  </code></pre>
  
  <p>or when the object is out of scope due to the method's execution is done:</p>
  
  <pre><code>public void gc(){
      Object a = new Object;
  } //once gc method is done the object where a is referring to will be available for garbage collection
  </code></pre>
  
  <p>given with the out of scope isn't also the same when the application just ended?</p>
  
  <pre><code>class Ink{}
  public class Main {
      Ink k = new Ink();
  
      public void getSomething(){
          //method codes here
      }
  
      public static void main(String[] args) {
          Main n = new Main();
      }
  }
  </code></pre>
  
  <p>where I expect 2 objects (Ink object and Main object) should be garbage collected when the application ends.</p>