the difference between equals() method and operator == ist that the first
one is virtual while the latter is not:
object o == "Hello";
o.equals(string.concat("He", "llo")); // will return true
o==string.concat("He", "llo") // will return false
So when using equals() it doesn't make any difference which type (object)
the variable is, only the actual type counts (string). If you use operator
== on a string variable and a object variable operator==(object, object) is
called which returns only true if and only if the objects are the same (the
same address).
--
cody
Freeware Tools, Games and Humour
http://www.deutronium.de.vu ||
http://www.deutronium.tk
"nyousfi" <ny*****@yahoo-dot-com.no-spam.invalid> schrieb im Newsbeitrag
news:41********@Usenet.com...
Hi
Whats the advantage in using .equals when comparing strings rather
than the = sign?
Thanks
NY
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*