title: static block vs private static method for static member initialization
body: <p>A static variables can be initialized with the private static methods or with a static block. Are there any subtle difference between the two? Are there any situation where I cannot use the static method for initializing static members? I found the later more readable.</p>
  
  <p>Static Block initialization : </p>
  
  <pre><code>private static int NUM_ITER;
  static {
      // Operations
      NUM_ITER = //val from above operations.
  }
  </code></pre>
  
  <p>Private static method initialization:</p>
  
  <pre><code>private static int NUM_ITER = calculateNumIter();
  
  // Some method comment on how we are calculating.
  private static int calculateNumIter()
  {
      // Operations.
      return //value_from_operations.
  }
  </code></pre>
  
  <p>I prefer the second one since it is more readable. Are there any situation I have to use only first (static blocks) ? </p>
  
  <p>What is the best coding convention/design for initializing static members(final as well as variable)? Even from this <a href="https://stackoverflow.com/questions/8189473/static-block-vs-static-method-initializing-static-fields">thread</a> I learned private static methods have an advantage over the static blocks.</p>
  
  <p>thanks,</p>