JShell (REPL) – The Java Shell

In earlier JDK, we did not have the luxury of running code using a command line interface. For learning new functions such as the matches function of regular expression API and many more, we had to write a necessary skeleton of Java, public static void main(String[] args), and go through the compilation and execution phase.

Java 9 introduced JShell, a command line tool. It uses the Read-Eval-Print Loop (REPL) principle to provide a command line interface to interact with the Java platform and provide an interactive way of running a program without writing necessary skeletons.

JShell came up with a parser that parses submitted code and identifies different types such as a variable, a declared method, loop, and ...

Get Java 9 Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.