Which of these options most closely matches the original design:

for (int i = 0; i < 10; i++) {
    System.out.println(i);
}
Explanation
The scope of the variable i, declared in the header of the cycle, is limited by this cycle.
In order to limit the scope of the variable you need to use an external block
{
  int i = 0;
  . . .
}

Слідкуй за CodeGalaxy

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

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