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.
2.1m questions
2.1m answers
60 comments
57.0k users