What will be printed out as a result of the following code compilation and execution?

public class A {
    {
        System.out.println("one");
    }

    public static void main(String[] args) {
        System.out.println("two");
    }

    static {
        System.out.println("three");
    }
}
Explanation
Static values initialization blocks are executed whenever the class is loaded for the first time regardless of the main(...) function. Usual initialization blocks are executed only after an instance of a given class is created. Therefore, the "one" string will not be printed out.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з Java
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести