(1)结论
基本类型int 25与封装类型Integer 25'=='的比较结果:true
封装类型Integer 25与封装类型Integer 25'=='的比较结果:false封装类型Integer 25与封装类型Integer 25'.equals()'的比较结果:trueint a=25和new Integer(a)'==' 比较的结果:trueInteger b=25,int a=25和new Integer(a)'=='比较的结果:falsenew Integer(57)与new Integer(57)'=='的比较结果:falsenew Integer(57)与new Integer(57)'.equals()'的比较结果:true(2)代码
public class Test { public static void main(String[] args) { int a=257; Integer b=257; Integer c=257; Integer d=new Integer(a); Integer d1=new Integer(a); System.out.println(a==b); System.out.println( (b==c)); System.out.println((b.equals(c))); System.out.println((a==d)); System.out.println((b==d)); System.out.println( (d == d1)); System.out.println( (d.equals(d1))); }}