I have gone through various articles, but I still do not know why instanceof
should not be used. Kindly let me know your thoughts.
Casting from a base type to a derived type is a bad thing. If you use instandof that way, it's considered bad design because hard to maintain and read. See http://www.javapractices.com/topic/TopicAction.do?Id=31.
Using instanceof
for equals() because you have an object
that should be your type, that's good practice.