The New Features in JDK14/Java 14?

  • Author: Techiediaries Team

Java 14 is due to be released on March 2020. It's not an LTS release and will be obsoleted with the release of Java 15.

Text Blocks

Sometimes you need to embed HTML, SQL, or JSON code into your Java code which can be done strings but it's usually hard to read, particularly the big portions of code. This why Java 14 introduced Text Block.

A text block contains zero or more content characters, which are enclosed by open and close delimiters.

This is an example string with HTML code:

String html = "<html>\n" +
              "    <body>\n" +
              "        <p>Hello, world</p>\n" +
              "    </body>\n" +
              "</html>\n";

Get our books

DMCA.com Protection Status