123456789101112131415161718192021222324252627282930313233343536 |
- package com.loveCoding.j20250426_java_basic;
- /**
- * @author WanJl
- * @version 1.0
- * @title Demo07
- * @description
- * @create 2025/4/26
- */
- public class Demo07 {
- public static void main(String[] args) {
- int a=1;
- switch (a){
- case 1:
- System.out.println("a是1");
- break; //作用是结束switch语句
- case 2:
- System.out.println("a是2");
- break;
- case 3:
- System.out.println("a是3");
- break;
- case 4:
- System.out.println("a是4");
- break;
- case 5:
- System.out.println("a是5");
- break;
- case 6:
- System.out.println("a是6");
- break;
- default: //如果以上条件都不满足,就执行default
- System.out.println("我也不知道是多少");
- }
- }
- }
|