Thread: == vs .equals()
View Single Post
Old 05-03-2004, 06:34 PM   #3 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,175
Belisarius is on a distinguished road
Oh, and "states[0]==myState" won't actually always fail. I messed around with it and was able to get it to return true. It's due to optimizations within the compiler.

Basically, the only time you use "==" with Objects is to test for "null".
__________________
GitS
Belisarius is offline   Reply With Quote