The original String is left unchanged. This approach is used because fixed, immutable strings can be implemented more efficiently than changeable ones. For those cases in which a modifiable string is desired, use StringBuffer. Both String and StringBuffer classes are defined in java.lang. Useful when you are exporting a String value into an environment that does not support 16-bit Unicode characters.
Nonalphabetical characters are unaffected.
String represents fixed-length, immutable character sequences. StringBuffer represents growable and writable character sequences. StringBuffer may have characters and substrings inserted in the middle or appended to the end. StringBuffer will automaticallt grow to make room for such additions and often has more characters preallocated than are actually needed, to allow room for growth. To set the length of the buffer.