I have a string:
String c = "IceCream";
If I use toUpperCase() function then it returns the same string, but I want to get "ICECREAM".
toUpperCase()
"ICECREAM"
Where is the problem?
The code
String c = "IceCream"; String upper = c.toUpperCase(); System.out.println(upper);
correctly prints "ICECREAM". However, the original string c isn't changed. Strings in Java are immutable so all operations on the string return a new copy.
1.4m articles
1.4m replys
5 comments
57.0k users