package com.cj.struct;
public class SwitchDemo01 {
public static void main(String[] args) {
//case穿透
//switch 匹配一个具体的值
char grade=‘C’;
switch (grade){
case 'A':
System.out.println("优秀");
break;
case 'B':
System.out.println("良好");
case 'C':
System.out.println("再接再厉");
case 'D':
System.out.println("优秀");
default:
System.out.println("未知等级");
}
}
}
package com.cj.struct;
public class SwitchDemo02 {
public static void main(String[] args) {
String name=“陈陈陈”;
//字符的本质还是数字
//反编译 java--class(字节码文件)---反编译(IDEA)
switch (name){
case "陈陈陈":
System.out.println("陈陈陈");
break;
case "陈陈":
System.out.println("陈陈");
break;
case "陈":
System.out.println("陈");
}
}
}