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 ...