标签:switch class cas scanner load 表达 jdk ifd intellij
package struct; import java.util.Scanner; public class ifDemo01 { public static void main(String[]args){ Scanner scanner=new Scanner(System.in); System.out.println("请输入内容:"); String s=scanner.nextLine(); if(s.equals("hello")){ System.out.println(s); } System.out.println("End"); } }
package struct; public class switchDemo01 { public static void main(String[]args){ String name="许璨"; //JDK后的新特性 表达式结果可以是字符串!!! //字符的本质还是数字 //反编译java--class(字节码文件)---反编译(IDEA) switch(name){ case"许璨": System.out.println("xc666"); break; case"憨憨": System.out.println("hh"); break; default: System.out.println("你在赣神魔"); break; } } }
反编译查看:
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) // package struct; public class switchDemo01 { public switchDemo01() { } public static void main(String[] args) { String name = "许璨"; byte var3 = -1; switch(name.hashCode()) { case 800000: if (name.equals("憨憨")) { var3 = 1; } break; case 1138672: if (name.equals("许璨")) { var3 = 0; } } switch(var3) { case 0: System.out.println("xc666"); break; case 1: System.out.println("hh"); break; default: System.out.println("你在赣神魔"); } } }
标签:switch class cas scanner load 表达 jdk ifd intellij
原文地址:https://www.cnblogs.com/xc666/p/14032681.html