标签:local struct ash compiler source image create class idea
package com.struct;
?
public class SwitchDomn01 {
public static void main(String[] args) {
char grade = ‘A‘;
//case穿透 //swith 匹配一个具体的值
?
switch (grade){
case ‘A‘:
System.out.println("youxiu");
break;
case ‘B‘:
System.out.println("lainghao");
break;
case ‘C‘:
System.out.println("jige");
break;
case ‘D‘:
System.out.println("hh");
break;
default:
System.out.println("weizhi");
}
}
}
?
源码所在路径:打开路径 进入文件找到class文件
将class文件复制到idea所属文件夹 再在其中打开
在idea中打开
package com.struct;
?
public class SwithDomn02 {
public static void main(String[] args) {
String name = "ling";
?
?
?
switch (name){
case "li":
System.out.println("li");
break;
case "ling":
System.out.println("ling");
break;
default:
System.out.println("hai a");
}
}
}
?
源码:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
?
package com.struct;
?
public class SwithDomn02 {
public SwithDomn02() {
}
?
public static void main(String[] args) {
String name = "ling";
byte var3 = -1;
switch(name.hashCode()) {
case 3453:
if (name.equals("li")) {
var3 = 0;
}
break;
case 3321846:
if (name.equals("ling")) {
var3 = 1;
}
}
?
switch(var3) {
case 0:
System.out.println("li");
break;
case 1:
System.out.println("ling");
break;
default:
System.out.println("hai a");
}
?
}
}
?
标签:local struct ash compiler source image create class idea
原文地址:https://www.cnblogs.com/lly-start/p/12654784.html