I'd have to look up the exact definition in the spec (you can do that as well) but let's put it that way:
Suppose you have the following:
class A {
static B b = new B();
}
class B {
static A a = new A();
}
If the classes would have to be fully initialized before creating new instances, i.e. all static initializers would have to run, you'd have a deadlock. Not allowing to create new instances in a static block would severely limit the language and thus there must be some way to resolve this.
As I said, I'd have to look this up but AFAIK the default order is like this:
- classes are loaded and static variables are initialized to their defaults
- as constructors are called top-down (i.e. from super class to sub class)
- first the static initializer blocks (i.e. initializing static variables as well as static blocks) are called in order of definition
- then the instance initializer block for the current class is executed and
- last the constructor is executed
Of course there are ways to mess with that order as you already found out but that's generally not recommended since you could end up with undefined/messy behavior. One such case would be calling a method in the super class constructor which is being overridden in the subclass and which accesses (not yet initialized) fields of the subclass.