I understand that this code doesn't compile because of an illegal forward reference.
public class StaticInitializerTest {
static{
staticVar++;
}
static int staticVar = 0;
}
But I don't understand why there is no illegal forward reference in this code.
public class StaticInitializerTest {
static{
staticVar = 12;
}
static int staticVar = 0;
}
P.S.: I'm using OpenJDK 1.8.0_66-b17