title: in what order are static blocks and static variables in a class executed?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3499214/java-static-class-initialization">Java static class initialization</a>  </p>
  </blockquote>
  
  
  
  <p>Why is the string variable updated in the initialization block and not the integer(even though the block is written first)</p>
  
  <pre><code>class NewClass
  {
      static 
      {
         System.out.println(NewClass.string+" "+NewClass.integer);
      }
  
      final static String string="static";
      final static Integer integer=1;
  
      public static void main(String [] args)//throws Exception
      {
      }
  }
  </code></pre>
  
  <p>My output is</p>
  
  <pre><code>static null
  </code></pre>
  
  <p>P.S:Also noticed that string variable initialization happens before the block only when i insert the final modifier. why is that?why not for integer as well?I have declared it as final static too</p>