Cauda Equina Syndrome

Cauda equina syndrome is a medical emergency and it must be diagnosed quickly, as well as treated urgently in order to avoid long term complications. It occurs at the level of the lower roots…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




What is New in Java 13

Greetings after a long break. In this post, I will tell you Text Blocks(JEP 355) and Switch Expressions(JEP 354) in Java 13.

Text Blocks(JEP 355) and Switch Expressions(JEP 354) are preview features for Java 13. You can use these features by enabling the preview-feature settings in your project.

If you are running java program from the command line, you can enable it using the --enable-preview switch. You can use this switch to start JShell with preview features enabled.

If you are using IntelliJ IDEA, you have to set the corresponding Language Level in the Project Structure settings and install the JDK to compile.

If you are using Eclipse, you can enable the preview features from the Java Compiler settings.

Multiline strings can be created easily with this preview feature. The multiline string has to be written inside a pair of triple-double quotes.

You can create these text blocks using just these quotes without the need for anything else.

Output:

Using text blocks in Java 13, also you can use new methods in String class. For example, formatted(Object... args), stripIndent(), translateEscapes().

With Java 12 release, switch expressions were added as a preview feature. I have already mentioned here how to use them in Java 12.

Java 12 release is almost same in Java 13 except yield . With Java 13, the break statement has been replaced with yield .

Output:

Switch expressions output

Add a comment

Related posts:

wordpress without wordpress

There are thousands of websites using wordpress and there is a reason for it. The ecosystem around wordpress is so huge. Just check out those millions of themes or the endless number of plugins…

Let It Go

I will share with you my favorite piece from my book. It took me so long to be at this stage of maturity and the ability to move on and forgive. Holding on to pain doesn’t fix anything, replaying the…

How to visualize a graph

Graph visualization is taking an increasingly important role in everyday life, both in the public and private sectors. A graph data representation makes sense when we have data connected to each…