📑 Table of Contents

JShell is a Java read-eval-print loop which was first introduced in the JDK 9.[1] It is tracked by JEP 222 jshell: The Java Shell (Read-Eval-Print Loop).[2] 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, which has been dormant since 2003, and arbitrarily diverged from the Java language.[3][4]

Example

edit
jshell> int a[] = { 0, 1, 3, 5, 8 }
a ==> int[5] { 0, 1, 3, 5, 8 }

jshell> int fact(int n) {
   ...>     return n < 2 ? 1 : n * fact(n - 1);
   ...> }
|  created method fact(int)

jshell> for (int i = 0; i < a.length; ++i)
   ...>     a[i] = fact(a[i]);

jshell> a
a ==> int[5] { 1, 1, 6, 120, 40320 }

See also

edit

References

edit
  1. ^ "Oracle Announces Java SE 9 and Java EE 8". Oracle Corporation. 2017-09-21. Archived from the original on 2017-09-22. Retrieved 2017-09-25.
  2. ^ "JEP 222: jshell: The Java Shell (Read-Eval-Print Loop)". Oracle Corporation. 2016-10-10. Retrieved 2016-11-01. Provide an interactive tool to evaluate declarations, statements, and expressions of the Java programming language, together with an API so that other applications can leverage this functionality
  3. ^ "JEP 222: jshell: The Java Shell (Read-Eval-Print Loop)". Oracle Corporation. 2016-10-10. Retrieved 2016-11-01. Another alternative is to maintain the status quo: Use another language or use a third-party REPL such as BeanShell, though that particular REPL has been dormant for many years, is based on JDK 1.3, and makes arbitrary changes to the language.
  4. ^ "JShell, the Java 9 REPL – What does it do?". jaxenter.com. 2015-09-03. Archived from the original on 2015-09-05. Retrieved 2016-11-01. BeanShell (just like Groovy, too by the way) made an attempt of standardisation by the Java Community Process in JSR 274 – a JSR that did not produce any notable output, in spite of the fact that (or perhaps because?) two major companies, Sun and Google, had joined the expert group. Under the JCP.next initiative this JSR was declared "Dormant".

📚 Artikel Terkait di Wikipedia

Read–eval–print loop

interface to the compiler. For example, starting with JDK 9, Java included JShell as a command-line interface to the language. Various other languages have

Java Development Kit

target system. (experimental) jrunscript – Java command-line script shell. jshell – a read–eval–print loop, introduced in Java 9. jstack – utility that prints

Java version history

Support for private methods in interfaces JEP 222: jshell: The Java Shell (Read-Eval-Print Loop): JShell is a REPL command-line interface for the Java language

BeanShell

BeanShell. The JSR 274 status is "Dormant". Since Java 9, Java instead includes JShell, a different read–eval–print loop (REPL) shell based on Java syntax, indicating

Exploratory programming

coding Software Prototyping through Microsoft Visual Studio through its JShell read-eval-print loop interpreter introduced in version 9 Rajib Mall (1 August

Java (software platform)

include: BeanShell – a lightweight scripting language for Java (see also JShell) Ceylon – an object-oriented, strongly and statically typed programming

Java Platform Module System

(jpackage) for creating platform-specific application packages. jdk.jshell Provides the jshell tool for interactively evaluating Java code snippets. jdk.jsobject