ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Calicrates Policroniades <Calicrates.Policronia...@cl.cam.ac.uk>
Subject Re: String compare
Date Mon, 23 May 2005 20:05:06 GMT

There are two things to note: objects have identity and state. If you use "a 
== b" to compare two objects you would be basically asking if two object 
references refer to the same object in memory (i.e. you are testing identity). 
The state of two objects (i.e. their data) may be the same and even so not 
returning a true when the "==" is used. The default implementation of equals() 
 also compares identity. However, in your case it will work as the String 
class overrides equals() and tests objects' data instead of objects' identity.

Hope it helps,
Cali


Mime
View raw message