title: What is the order running of the class / method in main [Java]
body: <p>Here is the code:</p>
  
  <pre><code>public static void main (String [] args) {
       new program1 () ;
       System.out.println("123Test") ;
  }
  
  public class program1 {
       public program1 () {
            abc () ;
       }
  }
  </code></pre>
  
  <p>In the above case, 123Test will be printed when the program1 is running. What I want to ask is that how to address make 123Test print out until the program1 has been finished?</p>
  
  <p>Somethings need to add is that in abc(), there will be a GUI, what I want to do is making a shutdown button. When someone press the button, the program1 will shutdown immediately like using frame.dispose(). Since I want to separate each JFrame into different classes, is there any ways to perform it better in the main? For example, I have program1 (), program2 (), program3 (), which represent different JFrame. </p>