<分区>
public class AutoBoxingAndUnBoxing
{
public static void main(String[] args)
{
Integer x = 127;
Integer y = 127;
System.out.println(x == y);//true
Integer a = 128;
Integer b = 128;
System.out.println(a == b);//false
System.out.println(a); // prints 128
}
}
为什么 x==y
为真而 a==b
为假?如果它基于值(Integer -128 To 127
) 那么'a'
应该打印-128
对吗?