标签:color equals bool 方法 转型 obj his lse object
public boolean equals(Object obj) { //使用乡下转型,把object转换成Person类型 if (obj instanceof Person){ Person p = (Person)obj; return this.name.equals(p.name) && this.age == p.age; }else{ return false; } }
标签:color equals bool 方法 转型 obj his lse object
原文地址:https://www.cnblogs.com/bozhengheng/p/12202620.html