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

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)

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты