Well...
Java equals() Method[
^] determines whether an object that invokes the method is equal to the object that is passed as an argument.
The reason of casting
other
object as
Foo
is one, the most important: you have to determine if
other
is type of
Foo
to be able to compare
data
(
Foo
's member). That's all!