- Java 9:Building Robust Modular Applications
- Dr. Edward Lavieri Peter Verhas Jason Lee
- 194字
- 2025-04-04 17:08:34
What is JShell?
JShell is a new tool introduced with Java 9. It is an interactive read-eval-print loop 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.
The introduction of JShell was a result of Java Enhancement Program (JEP) 222. Here are the stated goals of this JEP in regards to the Java Shell command-line tool:
- Facilitate rapid investigation
- Facilitate rapid coding
- Provide an edit history
The rapid investigation and coding listed previously includes statements and expressions. Impressively, these statements and expressions do not need to be part of a method. Furthermore, variables and methods are not required to be part of a class, making this tool especially dynamic.
In addition, the following listed features were included to make JShell much easier to use and to make your time using JShell as time-efficient as possible:
- Tab-completion
- Auto-completion for end-of-statement semicolons
- Auto-completion for imports
- Auto-completion for definitions