title: JAVA How Many times Static Block is Executed?
body: <p>I Have doubts about how it work static blocks in Java. As I understood, code inside static block is executed everytime that the class is loaded by JVM. What I don't understand is WHEN exactly a class is loaded.</p>
  
  <p>For Example, let's suppose I have static Block inside the class <code>MyObject</code>, and then from another class I have this code:</p>
  
  <pre><code>MyObject o1= new MyObject();
  MyObject o2= new MyObject();
  </code></pre>
  
  <p>How many times the static block is executed in this case?</p>