title: Which will be loaded first static variable or static block?
body: <p>One of my friends asked me that which will load first static variable or static block.</p>
  
  <p>My answer points to static variable.</p>
  
  <p>So he gave me two equations and said to differentiate between them<br>
  <b>First Equation</b><br></p>
  
  <pre><code>public class Some {
      public static void main(String args[])
      {
          System.out.println(Some.x);
      }
      static {
          System.out.println(Some.x);
      }
      static int x=90;
  }
  </code></pre>
  
  <p>O/P: 0 90<br></p>
  
  <p><b>Second Equation</b><br></p>
  
  <pre><code>public class Some {
      public static void main(String args[])
      {
          System.out.println(Some.x);
      }
      static int x=90;
      static {
          System.out.println(Some.x);
      }
  }
  </code></pre>
  
  <p>O/P: 90 90<br></p>
  
  <p>I tried to decompile the byte code and found it's same for both the above equation.
  Please help me to differentiate between them.
  I am confused when the static variable will initialised.</p>