JShell is an important tool that is relatively new to the Java platform. It was introduced with JDK 9. It is an interactive REPL tool that is used to evaluate the following Java programming language components—declarations, statements, and expressions. It has its own API so that it can be used by external applications.
Read-Eval-Print Loop is often referred to as REPL, taking the first letter from each word in the phrase. It is also known as a language shell or interactive top level.
The introduction of JShell was a result of JDK Enhancement Proposal (JEP) 222. Here are the stated goals of this JEP in regards to the Java Shell command-line tool:
- Facilitates rapid investigation
- Facilitates rapid coding
- Provides an edit history
The rapid investigation and coding listed previously include statements and expressions. Impressively, these statements and...