Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
> I saw this simpler code elsewhere: > public boolean equals(Object obj) > Is this OK? Or are there any hidden glitches in this that aren't apparent to me? Looks fine to me. I think this is even simpler though if( ! (obj instanceof this.getClass() ) // Safe Cast and compare The language spec says that instanceof returns false if obj is null. Section 15.20.2 Type Comparison Operator instanceof If you're interested =) Replies: |
Sponsored Links
|