What is the defined execution order between static blocks and static initialization functions? Is it their order in the class definition?
For example:
public class Test {
static {System.out.println("1"); }
static int x = getX(); static int getX() { System.out.println("2"); return 5; }
static { System.out.println("3"); }
}
Prints 1,2,3 on my system. Is this guaranteed by Java? I've seen similar questions, but not one that contained an answer for this.