- public class Test {
-
- public static void main(String[] args) {
- Integer i5 = 128 ;
- Integer i6 = 128 ;
-
- System.out.println(i5 == i6);
- System.out.println(i5.equals(i6));
-
- System.out.println("-----------------------------------");
-
- Integer i7 = 127;
- Integer i8 = 127;
-
- System.out.println(i7 == i8);
- System.out.println(i7.equals(i8));
- }
- }
复制代码 System.out.println(i7 == i8);和 System.out.println(i5 == i6);不是一样的么 为什么一个是true ,一个是false
|
|