Going Beyond Java 8: Text Blocks

Introduction

String is undoubtedly the most used class in Java, and represents an exception among the classes of the standard library. In fact, its objects are always immutable, and these can be instantiated with a simplified syntax that makes us avoid the verbosity of the new operator and the call to the constructor, as is standard for almost all other classes. In addition, the memory management of these String objects is characterized by the reuse of instances already created through an internally-managed pool of strings. 

In the latest versions, other improvements are being made to this fundamental class to make its use more efficient, simpler to use, and less verbose. The compact strings introduced in Java 9 have undoubtedly made strings more performing. Then with Java 13, a new feature called text blocks has been introduced that allows us to use the String class in a more profitable and easier way.