switch语句及表达式使用,根据指定的年月计算输出该月有多少天? Year year = Year.of(2020); Month month = Month.of(2); int mm = month.getValue(); int in = switch (mm) { case 4, 6, 9, 11 -> 30; case 2 -> year.isLeap() ? 29 : 28; default -> 31; }; System.out.println(in);