A text block is a multi-line string literal feature in Java 15 and later. Avoids the need for most escape sequences, automatically formats the string in a predictable way, and gives the developer control over the format when desired.
The Text Blocks feature is built into Java 15, after having been previewed in Java 12, 13, & 14.
See the specifications:
- JEP 378: Text Blocks (Java 15)
- JEP 368: Text Blocks (Second Preview) (Java 14)
- JEP 355: Text Blocks (Preview) (Java 13)
- JEP 326: Raw String Literals (Preview) (Java 12)