public class LongDemo {
public static void main(String[] args){
Long a = new Long(127);
Long b = new Long(127);
Long c = Long.valueOf(127);
Long d = Long.valueOf(127);
Long e = Long.valueOf(128);
Long f = Long.valueOf(128);
System.out.println(a == b);
System.out.println(c == d);
System.out.println(e == f);
System.out.println(e.toString().equals(f.toString()));
}
}
以上执行结果为
快来和博主打成一片吧^_^