I has tried this and i feel that the output is contradictory to my thinking. equals method checks to see if the String literal is "meaningfully equivalent" . Based on that , I wrote a small program to check it. Here's it.
can you tell me why it goes to else block , when yogendra and Yogendra both does are "MeaningFully Equivalent". This has been nailing me. Please help.
Thanks in Advance.
Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
Joined: Aug 24, 2005
These two strings are not equal because the first character is different. "Y" does not equal "y".
If you want to do a non-casesensitive comparison use this:
Joined: Apr 04, 2006
Hi Scott ,
Thanks for your immediate reply. I tested and it worked !
Is there any workaround rather then using equalsIgnoreCase ?
Joined: Feb 02, 2006
Is there any workaround rather then using equalsIgnoreCase?
a.toLowerCase().equals(b.toLowerCase()), and a.toUpperCase().equals(b.toUpperCase()).
I do not think you want to use them instead of equalsIgnoreCase.