public final class Person {
private final short height, weight;
public PhoneNumber(short heightnum, short weightnum) {
this.heightnum= height;
this.weightnum= weight;
}
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof Person))
return false;
if (o == null)
return false;
Person p = (Person) o;
return p.height == this.height && p.weight == this.weight;
}
}
————————————————
原文:https://www.cnblogs.com/liyanyan665/p/11384671.html