1. Equal to the same
If two objects have the same type and the same property value, the two objects are said to be equal (equal), and if the two reference variables point to the same object, the two variables (objects) are called the same (identical). If two objects are the same, two objects are definitely equal, and conversely, if two objects are equal, they are not necessarily the same. When you use the usual equals "=" to determine whether the two objects are "equal," you actually determine whether the two objects are the same.
The function of the Equals () method in the object class: Compares whether the recipient object and the Parameter object are the same object, that is, whether the address of the object is the same. Therefore, the Equals () method in the object class determines whether two objects are the same, rather than judging whether the values of the individual domains of the two objects are equal.
To determine whether the values of the individual domains of the two objects are the same, you cannot use the Equals () method inherited from the object class, but you need to override the Equals () method in the class declaration.
The Equals method is required to compare whether the value of two strings is equal and cannot be used as equals "=". The Equals method has been overridden in the string class to compare the values of two strings for equality.
JAVA SE Learning Summary