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("不合法");
}
}
}

 

 

 

 

posted @ 2020-05-27 17:53  光光1234  阅读(372)  评论(0编辑  收藏  举报