All classes inherit the Equals method from the object class
The Equals method source code in the object class is as follows:
public boolean equals (Object obj)
{return this
= = obj;
}
The Equals method in object directly determines whether the value of this and obj itself is equal, which is used to determine whether the object that calls equals and the object referenced by the parameter obj are the same object, and the same object refers to the same storage unit in memory. Returns true if this and obj point to the same memory object for Hi, if this and obj point to the same block of memory, return false, noting that even two different memory objects with exactly the same content are returned false.
If it is the same memory, the Equals method in object returns True and, if it is different memory, returns false
If you want two objects of different memory but the same content to return True when they are equals, we need to rewrite the equal method of the parent class
The string class has overridden the Equals method in Object