1. 程式人生 > >關於Integer比較問題

關於Integer比較問題

 1 public class Test {
 2     public static void main(String[] args) {
 3         Integer a=127;
 4         Integer b=127;
 5         System.out.println(a==b);
 6         System.out.println(a.equals(b));
 7         Integer c=128;
 8         Integer d=128;
 9         System.out.println(c==d);
10         System.out.println(c.equals(d));
11 Integer e=0; 12 Integer f=null; 13 System.out.println(e==f); 14 System.out.println(e.equals(f)); 15 } 16 }