title: How does the compiler handle Main when instantiating own class
body: <p>EDIT: For clarification: </p>
  
  <p>Create a new class containing static main. Instantiate the same class during the main method. What does the JVM do when it arrives at that main method line of code as it is instantiating it?</p>
  
  <p>(How does the JVM know to "skip over" the static main() method in the following code during the while loop)</p>
  
  <p>I'm asking because I can't see any benefit to put static main into a class that you intend to instantiate, it seems much better to only ever put static main into a "launcher" class, built solely for the purpose of launching the application..</p>
  
  <p>Confusing for the dog class:</p>
  
  <pre><code>public class Dog {
      private int height;
  
      public static void main (String[] args) { // &lt;---- What does the JVM do when it reaches here during the object instantiation?
          int i = 0;
          Dog [] dogArray = new Dog[20];
          while (i &lt; 20){
               dogArray[i] = new Dog(); // Instantiate knew class
               dogArray[i].height = i*10; //whatever
               i++;
          }
      }
  }
  </code></pre>
  
  <p>Surely it is always better to create two classes, in this case:</p>
  
  <pre><code>public class Dog {
      private int height;
  
      getHeight{//etc...}
      setHeight{//etc...}
  }
  
  public class launchApplication{
  public static void main (String[] args) {
      int i = 0;
      Dog [] dogArray = new Dog[20];
      while (i &lt; 20){
           dogArray[i] = new Dog(); // Instantiate knew class
           dogArray[i].setHeight = i*10; //whatever
           i++;
      }
  }
  </code></pre>
  
  <p>}</p>