JAVA Switch语句的运用

 

 

 

Case:穿透  。  Switch:匹配一个具体的值。 break:组织case继续执行。

 public static void main(String[] args) {
String name = "胡二刀";
switch (name){
case"敖晨光":
System.out.println("敖晨光");
break;
case"刘冰洁":
System.out.println("刘冰洁");
break;
case"马云":
System.out.println("马云");
break;
default:
System.out.println("不合法");
}
}
}

 

原文地址:https://www.cnblogs.com/acg-lbj/p/12974960.html