Because Strings are not primitive values which can be compared with "==". Strings are objects and in order to compare the contents of the object rather than the references to the object (which is what "==" does), one must use a method like equals() or compareTo().
in this case, whether two objects refer to the same reference?? if so, how is that o/p??
Thanks in advance, Ramesh
Joined: Feb 07, 2005
This is part of the implementation of toUpperCase(Locale).
So basically the toUpperCase method checks first to see if there are any lowercase characters in the String. If there are, then it will create a new String. Otherwise, the method returns the same String.
The method toUpperCase() calls toUpperCase(Locale). [ April 04, 2006: Message edited by: Keith Lynn ]