On this page
  1. String
  2. Availability
  3. Syntax & Overview
  4. Notes & Pitfalls
  5. Example

String

Prev: `Object` | Up: builtins | Next: `record`
Rel: builtins, Classes, Records & Sealed Hierarchies
Ref: Java Docs — String
Tags: #public #prog #java #builtins #tier/core


Availability

Built-in / java.lang (java.lang Final Class) — available with zero import statements.

Syntax & Overview

String s = "hello";  /* + text blocks """...""" */

Immutable UTF-16 (compact Latin-1 internally since JDK 9) character sequence.

Notes & Pitfalls

Example

String s = "  hello, java  ".strip();
assert s.equals("hello, java") && s.startsWith("hello");

Linked from

Related notes