重写 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;
}
重写 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;
}
上一篇:java异常
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M