Java 13 holds the record for the smallest release. It concentrated on improvements to existing features. Switch Expressions were further refined, Text Blocks (preview) were introduced for easier multi-line string creation, the Socket API was reimplemented for better performance, and ZGC gained support for the Linux/AArch64 architecture.
September 2019
Java 13 holds the record for the smallest release. It concentrated on improvements to existing features. Switch Expressions were further refined, Text Blocks (preview) were introduced for easier multi-line string creation, the Socket API was reimplemented for better performance, and ZGC gained support for the Linux/AArch64 architecture.
Multi-line string literals with natural formatting
// Traditional multi-line strings
String html = "<html>\n" +
" <body>\n" +
" <p>Hello, World!</p>\n" +
" </body>\n" +
"</html>";
// Text blocks (Java 13 preview)
String html = """
<html>
<body>
<p>Hello, World!</p>
</body>
</html>
""";
// SQL queries become more readable
String sql = """
SELECT customer.name, customer.email
FROM customer
WHERE customer.age > 18
AND customer.status = 'ACTIVE'
ORDER BY customer.name
""";
// JSON formatting
String json = """
{
"name": "John Doe",
"age": 30,
"email": "john@example.com",
"active": true
}
""";
// Formatting with text blocks
String formatted = """
Name: %s
Age: %d
Email: %s
""".formatted("John Doe", 30, "john@example.com");