wrapperToPrimitive

Integer counter1 = 100;
Integer counter2 = 100;
System.out.print("counter1 == counter2: " );
System.out.println(counter1 == counter2); //Integer在-127~128 自动unboxing成int,true|| wrapper->primitive

Integer counter3 = 256;
Integer counter4 = 256;
System.out.print("counter3 == counter4: ");
System.out.println(counter3 == counter4); //false

你可能感兴趣的:(Prim)