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

Reply via email to