Casting in equals method

Mam pytanie dotyczące nadpisywaniaequals metoda w Javie. W mojej książce mam następujący przykład:

public class Dog{
     private String name;
     private int age;

public boolean equals(Object obj) {
    if(!(obj instanceof Dog)) return false;
    Dog other = (Dog) obj;                    ---> confused here
    if(this.name.equals(other.name) && (this.age == other.age) {
     return true;
    }
    else {
     return false;
    }
  }
}

Nie rozumiem, dlaczego muszę odwołać się doDog odniesienie. Jeśli to odniesienie nie jest typuDog zwracamy false. Dlaczego wszystkie kłopoty z odlewaniem?

questionAnswers(7)

yourAnswerToTheQuestion