What is the result of the following program:

public class Foo {
    public static void main(String[] args) {
        for (int k = 1; k <= 10; k++) {
            if (k % 5 == 0) break label;
            System.out.print(k + " ");
        }

    label:
        {
            System.out.print("stop!");
        }
    }
}
Explanation
Compilation completed with errors.
Labels (label) is used in conjunction with a break (or continue) to exit (or skip iteration) in cycle for, while, do-while, to which this break (continue) applies.

Следи за CodeGalaxy

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

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