1) ' = = ' and ' equals ' in the object class
The Equals method in the object class is the same as the ' = = ', and the comparison is "a reference to the memory address of the object heap stored in the stack memory", meaning that if the two variables refer to the same heap memory object, then they are ' = = ' and ' equals '.
2) "= =" and "Equals" in the String class, Integer, and so on
The ' equals ' method in String and integer classes is inherited from the object class, but they all rewrite the ' equals ' method. Thus, for these classes, ' = = ' compares the two-object references for equality, and the ' equals ' method
Compares the values of two objects for equality.
Conclusion:
For the string class, it is not possible to use ' = = ' instead of the ' equals ' method when comparing two strings.
For wrapper classes such as Integer and long, it is not possible to use ' = = ' instead of the ' equals ' method when comparing size.
For basic data types such as int and long, compare size directly with ' = = '.
Note: ' '! = ' and ' = = ' handle Similar
3) The valueof method of the integer type is special
When using the ValueOf method to convert a string type to an integer type, it is important to pay attention to the size of this value, because there is a mechanism for handling numbers in Java: -128~127 (or one)
Object comparison and value comparison for a class