I've recently realised you could do this (at least in Java 1.7+).
static interface MyInter {
int foo = 3;
}
static {
System.out.println(MyInter.foo);
}
How exactly is this legal?
Does the java compiler just turn int foo
into a final static field behind the scene or something?
(If that's the case, then, wow, Java is getting crazier and crazier!)