title: Why doesn't a simple Swing application terminate when a window is shown?
body: <p>Here's some sample code:</p>
  
  <pre><code>import javax.swing.*;
  
  public class MyApplicatin {
      public static void main(String args[]) {
          JFrame window = new JFrame();
          window.setSize(100,100);
          window.setVisible(true);
  
          System.out.println("Should terminate after printing this.");
      }
  }
  </code></pre>
  
  <p>Why doesn't this small application terminate after printing the last line?</p>
  
  <p>My guess is that Swing starts a new non-daemon thread. I'm reading about having to do the GUI stuff in Java in a separate thread all the time, if Swing already uses a separate thread, why would anybody write about that?</p>