title: Why static fields are not initialized in time?
body: <p>The following code prints <code>null</code> once.</p>
  
  <pre><code>class MyClass {
     private static MyClass myClass = new MyClass();
     private static final Object obj = new Object();
     public MyClass() {
        System.out.println(obj);
     }
     public static void main(String[] args) {}
  }
  </code></pre>
  
  <p>Why are the static objects not initialized before the constructor runs?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I'd just copied this example program without attention, I thought we were talking about 2 Object fields, now I saw that the first is a MyClass field.. :/</p>