1)輸出false是(C)
- Integer i01=59;
- int i02=59;
- Integer i03=Integer.valueOf(59);
- Integer i04=new Integer(59);
*A System.out.println(i01==i02);
*B System.out.println(i01==i03);
*C System.out.println(i03==i04);
*D System.out.println(i02==i04);
解析
Byte,Short,Integer,Long,Character這5種整型的包裝類也只是在對應值小于等于127并且大于等于-128時才可使用常量池,因為他們至占用一個字節(jié)(-128~127);

image.png
public class Test1 {
public static void main(String[] args) {
Integer a = 127;
Integer b = 127;
Integer c = 128;
Integer d = 128;
System.out.println(a == b);
System.out.println(c == d);
System.out.println(c == 128);
}
/*true
false
true*/
}