switch case语法

发布时间 2023-04-14 13:38:23作者: 盗版太极
  • switch(表达式)中表达式的值必须是一下六中类型:byte short char int 枚举 String
  • switch case 中 case情况都一样的可以考虑合并
switch(表达式){
	case 常量1:
	语句1;
	break;
	
	case 常量2:
	语句2;
	break;
	...

	default:
	break;
}