Core JavaJava 9

JShell in Java 9

Posted On
Posted By admin

One of the new features added by Java 9 is the JShell.  In this blog post,  I will be explaining how JShell works.

What is JShell ?

JShell provides REPL capabilities to Java. REPL stands for Read Evaluate Print Loop. Many languages like Python also provide REPL capabilities.

REPL allows you to write Java code and test it without the need to compile it.

 

How to launch JShell

Step 1 – Make sure you have JDK 9 installed

 

Step 2 -Open a Command prompt and navigate to the JDK\bin folder

 

Step 3 – Type JShell

How to Use JShell

Type the code that you want to test. I have typed 4+5. Press Enter

 

Step 5 – View the results

Example 2  – Using a Sysout statement

Example 3 – Assigning a value to a variable and using it

How to exit JShell

Type /exit

If you'd like to watch a detailed video tutorial of this topic or other related topics, do check out my Java course here

Also, if you'd like to test your Java knowledge, do check out my practice tests course here


If you like this post, please do let me know via the comments box below.  You can also connect with me via my Facebook Page or subscribe to my Youtube channel!

Related Post

leave a Comment