![]() ![]() I’m only going to cover how Text Blocks have changed in Java 14 in this blog. It introduces two new escape sequences, and s, to exercise finer control of how new-line characters and end-of-line spaces are handled in text blocks (multiline strings). In this tutorial, well see in detail how to use the Java 15 text blocks featureto declare multi-line strings most efficiently. The Text Blocks feature is in its second preview in Java 14. It starts and ends with a """ (three double-quotes marks) e.g. In a previous tutorial, we saw how we can use multi-line stringsin any Java version. Text blocks start with a (three double-quote marks) followed by optional whitespaces and a newline. ![]() With Java 13 and 14, we needed to enable it as a preview feature. A text block is a multi-line string literal and the feature offers a clean way to format the string in a predictable way, without using most of the escape sequences. Text blocks comprise multiple lines of text and uses three double-quote characters () as its opening and closing delimiter. Since Java 15, text blocks are available as a standard feature. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |