This is jshell, Java's REPL (Read, Eval, Print Loop). Type a Java
expression at the jshell> prompt on the right, hit return,
and it evaluates it and prints the resulting value — no class, no
main, no compiling. You can declare variables and methods and
then use them in later expressions:
jshell> 6 * 7
$1 ==> 42
jshell> String shout(String s) { return s.toUpperCase() + "!"; }
| created method shout(String)
jshell> shout("hello")
$2 ==> "HELLO!"
It's a real terminal: Tab completes names, the arrow keys edit
the line and walk your history, and Ctrl-C cancels the line
you're typing — or interrupts a snippet that's stuck running forever,
without losing your session. Restart gives you a completely fresh
session. Type /help for jshell's own commands.
The editor on the left works with jshell: click
to load what
you've written into the session — a Loaded from the editor:
line lists what came in. Your code loads as written: methods written at
the top level (no class needed!) are callable directly, while a class
loads as a class, so call its methods like
Scratch.method(...). Either way, a program's
main runs as just main().
Click it again after an edit and the definitions update in place. And if
you write a complete program, the Terminal tab's
compiles and
runs it from main instead.