Equality:如果兩個對象是相同的類型,并且它們各自帶有相同和等值的屬性。(They are instances of the same type and if each of the fields in one object matches the values of the fields in the other object) Equality必須滿足三個必要條件:reflexive,
* @param b an object to be compared with {@code a} for equality * @return {@code true} if the arguments are equal to each other * and {@code false} otherwise * @see Object#equals(Object) */ publicstaticbooleanequals(Object a, Object b) { ...
其實javadoc里面就已經寫的很明白:“Compares this BigDecimal with the specified Object for equality. Unlike compareTo, this method considers two BigDecimal objects equal only if they are equal in value and scale (thus 2.0 is not equal to 2.00 when compared by this method).”只是自己沒有去注意罷...