It is reflexive: for any non-null reference value x, x.equals (x) should return true.
具有反射性:对于任何非空的参考值x, x.e quals (x)应该返回真值。
It is transitive: for any non-null reference values x, y, and z, if x.equals (y) returns true and y.equals (z) returns true, then x.equals (z) should return true.
具有传递性:对于任何非空的参考值x、y和z,如果x.e quals (y)返回真值并且y.e quals (z)也返回真值,那么x.e quals (z)也应该返回真值。
You might wonder about the String class given the issue of out-of-order writes and a reference becoming non-null prior to the constructor executing. Consider the following code.
鉴于无序写入和引用在构造函数执行前变成非null的问题,您可能会考虑string类。
应用推荐