@Test
public void test1Long() {
Long a=(long) 19257;
Long b=(long) 19257;
System.err.println("The result of a==b is "+(a==b));
System. err.println("a.longValue()==b.longValue() results in "+(a.longValue()==b.longValue()));
public void test1Long() {
Long a=(long) 19257;
Long b=(long) 19257;
System.err.println("The result of a==b is "+(a==b));
System. err.println("a.longValue()==b.longValue() results in "+(a.longValue()==b.longValue()));
}
The result of running the above program is:
The result of a==b is false
The result of a.longValue()==b.longValue() is true
reason:
== in primitive data types compares the value of two primitive data types for equality
== In the reference data type, the comparison is whether the referenced objects are equal, that is, whether the same object is referenced, and the comparison is the address