重写 Object.equals()方法

public boolean equals(Object obj)
{
  
if(obj ==nullreturn false;
  
else
  {
    
if(obj instanceof Cat)
    {
      cat c 
= (cat)obj;
      
if(c.color == this.color && c.height == this.height)
        {
          
return true;
        }
    }
  }
  
return false;
}

相关文章:

  • 2021-09-03
  • 2022-12-23
  • 2021-12-27
  • 2021-11-28
  • 2021-08-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2021-05-27
相关资源
相似解决方案