What are the different shortcut keys in JShell in Java 9?

JShell is an interactive tool that allows us to execute the java code and getting immediate results. We quickly evaluate expressions or short algorithms without compiling or build it. We can execute expressions, classes, methods, variables, and etc with the help of the JShell tool.

Below are some of the keyboard shortcut keys:

  • Entrance - Validate the line
  • Left arrow - Move left in the line
  • Right arrow - Move right in the line
  • Ctrl-A - Move to the start of the line
  • Ctrl-E- Move to the end of the line
  • Alt-B - Move left, word by word
  • Alt-F - Move right, word by word
  • Delete - Delete characters after the cursor
  • Backspace - Delete characters before the cursor
  • Ctrl-k- Delete the characters between the cursor and the end of the line
  • Alt-D - Delete the text after the cursor
  • Ctrl-W- Delete the text before the cursor
  • Ctrl-Y- Restore recently deleted text

The above shortcuts are practical to use on short-code but on large code like the creation of a method or class etc, then we can use JShell Edit Pad. It allows us to modify our code very easily.

Updated on: 04-Mar-2020


Kickstart Your Career

Get certified by completing the course

Get Started