Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getClass() vs. Instanceof in equals()

807580Feb 8 2010 — edited Feb 9 2010
As we know there are differing opinions on what is better to use in overriding equals(). getClass() or instanceof for

argument type checking.

I would like to know if there is anyoneone who is strongly in favor of using instanceof instead of getClass()?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 9 2010
Added on Feb 8 2010
9 comments
1,614 views