// 正常情况应该是两个比较都是false 为什么 会100 会出现false呢 只是因为 jdk 会缓存 -127 128 之间的整数 这时的比较就是两个缓存的值得比较
public static void main(String[] args) {
String d =tsetString();
System.out.println(d); // true
String f =tsetString2(); //false
System.out.println(f);
}
public static String tsetString(){
Integer a = 1000;
Integer b = 1000;
String c = " ";
if(a==b){
c = "true";
}
else{
c = "false";
}
return c;
}
public static String tsetString2(){
Integer a = 100;
Integer b = 100;
String c = " ";
if(a==b){
c = "true";
}
else{
c = "false";
}
return c;
}