title: Static and Non-Static initialization blocks in Java
body: <p>Why does this code print <code>11</code> and not <code>10</code>. Clearly , <code>i++</code> in the static initialization block is executed.<br />
  But , why <code>i--</code> in  the non-static block is not executed.<br />
  What's happening here ?</p>
  <pre class="lang-java prettyprint-override"><code>class ClassOne
  {
      static int i = 10;
  
      {
          i--;
      }
  
  }
  
  public class Main extends ClassOne
  {
      static
      {
          i++;
      }
  
      public static void main(String[] args)
      {
          System.out.println(i);
  
      }
  }
  
  </code></pre>