All statements after the matching case label are executed in sequence, regardless of the expression of subsequent case labels, until a break statement is encountered.
In our case System.out.println("default"); is unreachable statement, because flow falls out of the switch statement after break statement.
Therefore compilation error will appear: "error: unreachable statement"
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать