Introduce about text block in Java

Previously, when declaring a multi-line text in Java, for example:

We will usually declare the following:

Result:

Introduce about text block in Java

But from Java 13 onwards, you do not need to declare so anymore. Java now supports the text blocks with the ability to declare multiple lines without the need for plus signs (+) to concatenate strings. In the above example, we can now rewrite the following:

You just need to declare your multi-line text between two characters (“””).

The same result:

Introduce about text block in Java

5/5 - (1 vote)

Add Comment