Interactive programming (repl): Difference between revisions
New post. An existing post was retained, although in my personal opinion it certainly does not accomplish the task.
(New post. An existing post was retained, although in my personal opinion it certainly does not accomplish the task.) |
|||
Line 701:
Rosetta::Code
</syntaxhighlight>
Alternatively
<syntaxhighlight lang="java">
Java has an interactive REPL (Read-Evaluate-Print-Loop) console, jshell, that is included with the JDK. *
The REPL is started by invoking: $JAVA_HOME/bin/jshell *
Here is a sample session to accomplish this task.
| Welcome to JShell -- Version 20
| For an introduction type: /help
jshell> String concat(String a, String b, String c) { return a + c + c + b; }
| created method concat(String, String, String)
jshell> concat("Rosetta", "Code", ":")
$2 ==> "Rosetta::Code"
jshell>
</syntaxhighlight>
|