JavaBeginner#strings#java15

What is text block syntax in Java (Java 15+)?

Text blocks use triple-quotes to define multi-line string literals without needing explicit \n or concatenation, improving readability for JSON, SQL, or HTML embedded in code.

Example
String json = """
{
  "name": "Alice"
}
""";
System.out.println(json);

Related Questions

1
JavaIntermediate#strings

What is the String pool (intern pool)?

Open
2
JavaBeginner#strings

How do you reverse a String in Java?

Open
3
JavaBeginner#strings

How do you check if a String is a palindrome?

Open