重写 Object.equals()方法
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;
}
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;
}