Features of the equals () method of the Object class:
1) Self-inverse: for non-null reference x, x. equals (x) must return true;
2) symmetry: for non-null references to x and y, if x. equals (y) returns true, then y. equals (x) returns true;
3) transmission: for non-null references x, y, and z, if x. equals (y) returns true, and y. equals (z) returns true, then x. equals (z) must return true;
4) Consistency: for non-null references x and y, if x. if true is returned for equals (y), true is returned for the second, third, and n calls to the equals method, the precondition is that during the call, neither x nor y will change, and vice versa;
5) for non-null reference x, x. equals (null) returns false.
Features of the hashCode () method of the Object class:
1) during a Java program running, if the hashCode method is called multiple times for the same object, the returned int value is the same, provided that the object has not changed during multiple calls; the returned value of the hashCode method of an object during this Java program Runtime is different from that of the hashCode method of the object during the previous Java program runtime.
2) If two objects return true after comparison using the equals method, the return value of their hashCode method is the same integer;
3) If two objects are returned as false after comparison using the equals method, the return values of their hashCode method are generally different integers.