Я пытаюсь написать метод equals для объектов, который сравнивает их поля и возвращает true, если они равны.
private int x, y, direction;
private Color color;
public boolean equals(Ghost other){
if (this.x == other.x && this.y == other.y &&
this.direction == other.direction && this.color == other.color)
return true;
else
return false;
}
Что может быть не так с этим?
if. ;-) - person Dave Jarvis   schedule 16.10.2010this.x == other.x) перед оператором if. Посмотрите, какие из них терпят неудачу. - person Tony Ennis   schedule 16.10.2010