JEP-355 was an excellent change brought in Java 13 as a preview to simplify the HTML code piece in Java. But, now, Java 14 has come up with a second preview in Text Blocks with two more newly added escape sequences. This change is present under JEP-368. You can download Java 14 by clicking here.

  • \<end-of-line> for newlines (line terminator)
  • \s for single space (white space)


Java 14 - Text Blocks - Key Change for HTML...!!! Share on X

Check out: JAVA 13 Features with examples

JEP 368 – Text Blocks

In Java 13, JEP 355 allows you to create a multiline string or you can say a text-block. You need to write a multiline string inside a pair of triple double-quotes. But, now, in Java 14, JEP 368 has new line & white space sequences too. Let’s check it.

Let’s see the below code that differentiates between code before Java13, In Java13 and finally IN JAVA 14

Output:

Java 14 - Text Blocks - Key Change for HTML...!!! Share on X

Other Useful References:

    • What is new in Java 13

Author

  • Deepak Verma

    Deepak Verma is a Test Automation Consultant and Software development Engineer for more than 10 years. His mission is to help you become an In-demand full stack automation tester. He is also the founder of Techndeck, a blog and online coaching platform dedicated to helping you succeed with all the automation basics to advanced testing automation tricks.

    http://Techndeck.com deepak.rkgit@gmail.com Verma Deepak