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
The declared type of obj is Object, so you must cast it to tell the compiler that it is a Dog.
obj
Object
Dog
Although logically it can't be anything else at that point in the code, the compiler doesn't know anything about logic - it only knows about the type.