title: static initialization block vs constructor java
body: <pre><code>class prog
  {
      static
      {
          System.out.println("s1");
      }
      prog()
      {
          System.out.println("s2");
      }
  
      public static void main(String...args)
      {
          prog p = new prog();
      }
  }
  </code></pre>
  
  <p>Output is </p>
  
  <pre><code>s1
  s2
  </code></pre>
  
  <p>As per the output, it seems that static initialization block gets executed before the default constructor itself is executed.</p>
  
  <p>What is the rationale behind this?</p>