class D {
public static void main(String args[]) {
Integer b2=128;
Integer b3=128;
System.out.println(b2==b3);
}
}
输出:
false
class D {
public static void main(String args[]) {
Integer b2=127;
Integer b3=127;
System.out.println(b2==b3);
}
}
输出:
true
注意:介于-128和127之间的数字是真实的。
false
。实际上,这可能已经发生了,因为应用逃逸分析和标量替换的副作用。 - Holger