JShell In Java 9 - Part 1

Introduction to the JShell:

This Feature was introduced by Java from Java 9.

Q1.What is Jshell? 
   
Jshell is Java's Shell. It is also known as an Interactive console. 
Jshell is Java's own REPL tool.
REPL  stands for  Read Execute Print Loop.
Refer this image.
By using this tool we can execute Java code snippets and we can get immediate results. 

Using Jshell we can test and execute Java expressions, statements, methods, classes etc. After testing small code we can plug that code in our project.

Before Java 9 we cannot test a small piece of Java code without any Java class. But from Java 9 onwards we can execute the small piece of without having complete class structure.

Its a new thing for java but this kind of tool is already available in the various language like Python, Scala, Swift.

Limitation of Jshell:
  •  JShell is not meant for Main Coding. We can use it to test small coding snippets, which can be used in our Main Coding. 
  •  JShell is not a replacement of Regular Java IDEs like Eclipse, NetBeans etc.





Share this

Related Posts

Previous
Next Post »