标签:referenceequals
-
在“等于(T值)”中,T必须是对象,还是像城市等? - java
我试图更好地理解equals()方法。我看过的所有示例都执行以下操作: public class City { public boolean equals(Object other) { if (other instanceof City && other.getId().equals(this.id)) { return true; } / […]
我试图更好地理解equals()方法。我看过的所有示例都执行以下操作: public class City { public boolean equals(Object other) { if (other instanceof City && other.getId().equals(this.id)) { return true; } / […]