标签:absolute bubble code style ann 问题 top data- can
Scanner sc = new Scanner(System.in); System.out.println("请输入月份:"); int month = sc.nextInt(); switch (month) { case 1: case 2: case 3: System.out.println("第一季度"); break; case 4: case 5: case 6: System.out.println("第二季度"); break; case 7: case 8: case 9: System.out.println("第三季度"); case 10: case 11: case 12: System.out.println("第四季度"); break; default: System.out.println("您输入的月份有问题。"); break; }
注意: break表示跳出switch. 如果不写break则会发生case穿透现象
标签:absolute bubble code style ann 问题 top data- can
原文地址:https://www.cnblogs.com/wenyule/p/12182104.html