📜  切换java代码示例

📅  最后修改于: 2022-03-11 14:52:05.535000             🧑  作者: Mango

代码示例6
System.out.println(
        switch (day) {
            case MONDAY, FRIDAY, SUNDAY -> 6;
            case TUESDAY                -> 7;
            case THURSDAY, SATURDAY     -> 8;
            case WEDNESDAY              -> 9;
            default -> throw new IllegalStateException("Invalid day: " + day);
        }
    );