I have gone through various articles, but I still do not know why instanceof should not be used. Kindly let me know your thoughts.
instanceof
When you know the object being passed then you need not use it. If there is any ambiguity involved (like two classes implementing the same interface) then it is advised to use instanceof before proceeding further.