【发布时间】:2016-03-16 04:49:48
【问题描述】:
我在 Java 中有以下几行代码:
public class myProjects {
public static void main(String[] args) {
// TODO Auto-generated method stub
Integer d = Integer.MAX_VALUE;
Integer e = Integer.MAX_VALUE;
System.out.println(d);
System.out.println(e);
if(d == e){
System.out.println("They are equal\n");
}else {
System.out.println("They are not equal\n");
}
}
}
Output:
2147483647
2147483647
They are not equal
为什么它们即使具有相同的值也不相等?
【问题讨论】:
标签: java