Java 13 APIs & Features

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.

Released: September 2019
Standard Release

Java 13 Overview

Release Information

Release Date:

September 2019

Support Type:
Standard Release

Quick Summary

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.

Top Features

  • Refined Switch Expressions with enhanced syntax
  • Text Blocks (Preview) for multi-line string literals
  • Socket API Reimplementation for better performance
  • ZGC support for Linux/AArch64 architecture
  • Dynamic CDS Archives for improved startup
  • Reimplement the Legacy Socket API

API Examples

Text Blocks (Preview)

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");