Каким будет результат компиляции и выполнения данного кода:

public class Test {
    static int b = Test.a;
    static int a = 3;
    static {
       System.out.println("a=" + a + ", b=" + b);
    }
}
Укажите все подходящие варианты.
Explanation
The static initializers and class variable initializers are executed in textual order, and may not refer to class variables declared in the class whose declarations appear textually after the use, even though these class variables are in scope (§8.3.2.3). This restriction is designed to detect, at compile time, most circular or otherwise malformed initializations.

( JLS 12.4.1)

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes