Objects of the String Class Are Immutable
The String class is immutable, so that once it is created a String object cannot be changed. The String class has a number of methods, some of which are discussed in the text, that appear to modify strings. Since strings are immutable, what these methods really do is create and return a new string that contains the result of the operation.
This is contrasted with the use of strings in C++ where the individual elements can be changed by traversing the array used to hold the string.