title: Java - Default Initialization of static variables before Static initialization
body: <p>I want to know that does default initialization of static variables happens before static initialization or along with it ? </p>
  
  <p>Let us look at code below:</p>
  
  <pre><code>class Test {
  
      static {
          System.out.println(Test.a);  // prints 0
          a = 99; // a get 99
          System.out.println(Test.a); // prints 99
      }
  
      static int a = 10;
  
      static {
          System.out.println(a); // prints 10
      }
  
      public static void main(String[] args) {
  
      }
  }
  </code></pre>
  
  <p>My guess is that when class is loaded , all the static variables are created in memory and default values given to them then and there only. Then static initialization takes place in the order static initializers and static fields that appear in code . Am I right ?</p>
  
  <p><strong>EDIT :</strong> I am aware of the order of static initialization but I am unable to get the point in JLS where it tells us that default initialization happens before static initialization takes place ?</p>