Section 14.3 Class String

String objects are immutable (p. 599)—after they’re created, their character contents cannot be changed.

String method length (p. 599) returns the number of characters in a String.

String method charAt (p. 599) returns the character at a specific position.

String method regionMatches (p. 601) compares portions of two strings for equality.

String method equals tests for equality. The method returns true if the contents of the Strings are equal, false otherwise. Method equals uses a lexicographical comparison (p. 602) for Strings.

• When primitive-type values are compared with ==, the result is true if both values are identical. When references are compared with ==, the result is true if both refer to the same ...

Get Java™ How To Program (Early Objects), Tenth 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.