title: Static Block and Main Thread
body: <p>I found a very interesting thing while trying with java. Please find the code below: </p>
  
  <pre><code>public class SimpleTest { 
      static{ 
          System.out.println(Thread.currentThread().getName()); 
          System.exit(0); 
      } 
  } 
  </code></pre>
  
  <p>The above program runs without any exception (Well &amp; good since I'm exiting in the static block itself). But i got the following as the output: </p>
  
  <blockquote>
    <p>main </p>
  </blockquote>
  
  <p>Since I haven't started the main thread, how does it got created. As per my understanding static block is executed during the load time. Then how does main thread come into picture? </p>
  
  <p>Can anyone please give the brief introduction how the compilation, loading and execution done in jvm? Also the use of rt.jar? </p>
  
  <p>Thanks in advance, 
  Brinal</p>