Friday 8 January 2021

Jshell: reset: Reset jshell session

/reset command is used to reset jshell session.

 

Step 1: Open terminal and execute jshell command to open jshell terminal.

$jshell
|  Welcome to JShell -- Version 10.0.2
|  For an introduction type: /help intro

 

Step 2: Execute below statements.

var a = 10

var b = 20

var c = a + b

jshell> var a = 10
a ==> 10

jshell> var b = 20
b ==> 20

jshell> var c = a + b
c ==> 30

 

Execute /list command to list all the typed commands.

 

jshell> /list

   1 : var a = 10;
   2 : var b = 20;
   3 : var c = a + b;

Step 4: Execute the command /reset to reset the state.

jshell> /reset
|  Resetting state.


Step 5: Now execute the command /list to check whether jshell session is reset or not.

jshell> /list

jshell> 
 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment