
Java REPL
JShell
Java 11
Java REPL & JShell
Java Shell
The Java Shell or JShell is an official Read-Evaluate-Print-Loop, or REPL as it's commonly called, introduced with Java 9.
It provides an interactive shell for quickly prototyping, debugging, and learning Java and Java APIs, all without the need for a public static void main or the need to compile your code before executing it.
And as an added plus, using JShell just got a whole lot less verbose (and more practical) with the advent of the var keyword in Java 10!

OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
https://java-repl.xgqfrms.repl.run
https://repl.it/@xgqfrms/java-repl#HelloWorld.java
javac -classpath .:/run_dir/junit-4.12.jar:target/dependency/* -d . HelloWorld.java Main.java
java -classpath .:/run_dir/junit-4.12.jar:target/dependency/* Main
Hello world!
⚠️ 创建文件 HelloWorld.java 的文件名必须要与类名保持一致
注:String args[] 与 String[] args 都可以执行,但推荐使用 String[] args,这样可以避免歧义和误读。
https://www.runoob.com/java/java-tutorial.html
发布文章使用:只允许注册用户才可以访问!
xgqfrms