This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
instanceof can be dangerous; if used improperly, you can break one of the rules for equals: if x.equals(y), then y.equals(x) should be true.
Consider the following piece of code:
Now if class A is final, or the equals method is final, there's no big issue. But otherwise, it is very well possible to break the contract in a sub class. You might not do it, but someone else still can.
Now if you use the Class comparison, then a.equals(b) will be false as well, therefore not breaking the contract.