10.5. The String Class

Handling character strings is supported through two final classes: String and StringBuffer. The String class implements immutable character strings, which are read-only once the string has been created and initialized, whereas the StringBuffer class implements dynamic character strings.

Character strings implemented using these classes are genuine objects, and the characters in such a string are represented using 16-bit characters (see Section 2.1, p. 23).

This section discusses the class String that provides facilities for creating, initializing, and manipulating character strings. The next section discusses the StringBuffer class.

Creating and Initializing Strings

String Literals Revisited

The easiest way of creating ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.