Test:
System.out.println (new Long) ==new Long (1000));
System.out.println (New Integer (==new) integer (1000));
System.out.println (new double (1000d) ==new double (1000d));
System.out.println (new float (1000f) ==new float (1000f));
System.out.println (New Boolean (True) ==new Boolean (true));
System.out.println (New short ("+") ==new short ("400");
False
False
False
False
False
False
The long type refers to the Java.util.Lang object, not the base type long (note case)
If you use the = = Double equals comparison object in Java, it is equivalent to comparing the memory address of two objects, that is, comparing two objects is the same object
If you compare two long object values for equality, you cannot compare them by using a double equal sign, which can be done in the following way:
1. Use the Equals method
Long a = new long (3);
Long B = new Long (3);
System.out.println (A.equals (b));
2. Use the Longvalue () method in the Long type to compare
Long a = new long (3);
Long B = new Long (3);
System.out.println (A.longvalue () ==b.longvalue ());
Java Long, Integer, Double, Boolean types cannot be directly compared