Integer Long大小比较

 private static void equalsTest(){
  Integer a = new Integer("8");
  Integer b = new Integer("8");
  Long c = new Long("8");
  System.out.println(a==b);//false
//  System.out.println(a==c); //编译错误
  System.out.println(a.equals(b));//true
  System.out.println(a.equals(c));//false
  System.out.println(a.equals(8));//true
 }

你可能感兴趣的:(Integer Long大小比较)