5.4 Strings
A string is a collection of characters (data type char ) that the runtime environment stores in the memory in an orderly fashion. The characters are taken from a character set that corresponds to the 16-bit Unicode standard in Java—with some workarounds, Unicode 4 with 32-bit characters is also possible.
Strings can be structured as char arrays, but arrays are not flexible. For this reason, Java provides three central classes that conveniently manage strings. These classes differ in two respects:
-
If the strings are immutable, then they can’t be changed after they have been created. In general, objects with unchangeable states are referred to as immutable . Alternatively, should the strings be permanently mutable ?
-
Are the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access