title: Why after creating a JFrame object and setting it as visible, the program will not end executing?
body: <p>My program looks like this:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  public class Main {
      public static void main(String[] args) {
          JFrame jf = new JFrame();
          jf.setSize(new Dimension(200, 200));
          jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          jf.setVisible(true);
      }
  }
  </code></pre>
  
  <p>I'm just confused why after JVM's quitting from main(), my program does not end instantly? I noticed that if I remove the line "jf.setVisible(true);", it will end.</p>
  
  <p>Is it implemented though techniques like garbage collecting or class destructors? I'm interested that if I want to write something similar, how could I do it.</p>