// 正常情況應該是兩個比較都是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;
}