Text Block

A multiline string literal enclosed by three double quotes.

What is Text Block in Java?

Text Block — A multiline string literal enclosed by three double quotes.

class Menu {
    String text = """
            Tea
            Coffee
            """;
}

Level: Apprentice · More Java terms at this level

Updated