[code]public static void main(String[] args) {
// TODO Auto-generated method stub
Integer i = 3;
Integer j = 3;
System.out.println(i == j);
System.out.println(i.equals(j));
Double b1 = 3.0;
Double b2 = 3.0;
System.out.println(b1 == b2);
System.out.println(b1.equals(b2));
}
打印结果 true true false true
既然Integer中比较都相等,Double的为啥不相等呢? |