import java.util.Scanner; //switch 穿透练习 public class demo02 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int score = scanner.nextInt(); switch (score) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println(31 + "天"); break; case 2: System.out.println("闰月"); break; case 4: case 6: case 9: case 11: System.out.println(30+"天"); break; default: System.out.println("输入有误"); } } }
用switch穿透输出月份
于 2024-08-06 15:43:38 首次发布