-
-128~127的范围,int和Integer用"=="或"equals"比较相同数值时,都是true;
-
<-128或>127情况:
- Integer和int用"=="或"equals"比较相同数值时,都是true;
- Integer和Integer用"equals"比较相同数值时,都是true;
- Integer和Integer用"=="比较相同数值时,都是false;
/**
* @author: alen.wang
* @date: 2020-09-03 11:20
*/
public class Test {
public static void main(String[] args) {
Integer itr1 = 127;
Integer itr11 = 127;
Integer itr2 = 128;
Integer itr3 = 128;
Integer itr4 = -128;
Integer itr44 = -128;
Integer itr5 = -129;
Integer itr6 = -129;
int i1 = 127;
int i2 = 128;
int i3 = 128;
int i4 = -128;
int i5 = -129;
System.out.println(&