public boolean equals(Object obj)
{
if(obj ==null) return false;
else
{
if(obj instanceof Cat)
{
cat c = (cat)obj;
if(c.color == this.color && c.height == this.height)
{
return true;
}
}
}
return false;
}
原文:http://www.cnblogs.com/Dzz233/p/5651830.html