What is the result of the following code compilation and execution?

public class Main{
    final int x = 1;

    public static void main(String [] str) {
        int x = 2;                            //1
        for (x = 3 ; x < 5 ; x++);            //2
        System.out.println("x=" + x);

    }    
}

I didn't know cycles could have no body.

2023 Feb 17, 10:10:00 AM

scopes are different

2022 Aug 21, 7:18:23 PM

Следи за CodeGalaxy

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

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