I have a question about overriding the equals method in Java. In my book, I have the following example:
equals
public class Dog{ private String na
You are overriding equals method to check equality by value not by reference..
value
reference
i.e You want two dogs equal if they have same name and age not if they are owned by the same person(i.e not if their references are equal)
name
age
Without cast you can't access dog's name and age members