Oracle Corp has introduced a new tool called “jshell”. It stands for Java Shell and also known as REPL (Read Evaluate Print Loop). It is used to execute and test any Java Constructs like class, interface, enum, object, statements etc. very easily.
After installation of JDk1.9, go to command prompt and type jshell then it will open jshell environment for you.


In jshell environment you can execute commands and java statements. For command we use /(slash). Example,
In jshell environment, we type /help command then we get list of command(all commands) that we use.


To come out from  the environment the following command we type,


Here in jshell environment writing code is very simple, and very easy to write. For example, I want to print a message then there is no need to declare a class, no need to define a main() method. We can directly write System.out.println(“JAVA means SILAN TECHNOLOGY”)
Here semicolon(;) is also optional, whether u may put or u may not put.



This is the base thing of jshell.
Now I want to perform some operation, then it is very simple. Let’s see :


Here the question may arise what is $2
$2 is the unique id whose value is representing as 50
For clarity, if u will type $2, then


If u type $2+50, then u get


Now $4 is the id. We can use this id in a statement, like
System.out.println($4), then the output is 100


We can perform some logical operations. Let’s see


We can declare variable and initialize it also. For example




Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

Silansoftware Pvt.Ltd, BBSR
Call to: 0674-2361252