JShell is a
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
read-eval-print loop which was first introduced in the
JDK 9. It is tracked by
JEP 222 ''jshell: The Java Shell (Read-Eval-Print Loop)''. One reason why JShell was proposed for Java 9 is the lack of a standard interactive environment for the language; the ''de facto'' library to use a Java REPL was often
BeanShell
BeanShell is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. It runs in the Java Runtime Environment (JRE), dynamically executes standard Java syntax and extends it with common scripting c ...
, which has been dormant since 2003, and arbitrarily diverged from the Java language.
[
]
Example
jshell> int a[] =
a > int[5]
jshell> int fact(int n)
, created method fact(int)
jshell> for (int i = 0; i < a.length; ++i)
...> a[i] = fact(a[i]);
jshell> a
a > int[5]
See also
*
Exploratory programming
Exploratory programming, as opposed to implementation (programming), is an important part of the software engineering cycle: when a domain is not very well understood or open-ended, or it's not clear what algorithms and data structures might be ne ...
References
Command shells
Cross-platform software
JDK components
Interpreters (computing)
{{prog-lang-stub