What is the result of the following code execution?

public class Test {
    static { i = 5; }
    static int i = 6;

    public static void main(String[] args) {
Static initialization blocks and initialization of static variables are performed in the same order in which they are indicated in the class. Therefore, i = 5 command will be executed first and i = 6 after.

very good quesiton

2017 Jun 16, 12:01:15 PM

Следи за CodeGalaxy

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

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