Java SE 9 (JDK9) Environment installation and interactive programming environment Jshell example, jdk9jshell
Purpose
Install JDK 9 and use the Jshell tool to experience the interactive Java programming environment.
What is Jshell?
It is actually a command line tool. After JDK 9 is installed, you can find the tool in the bin directory, which is very similar to the Python interpreter, people who have used Python interpreters should be very familiar with it.
It allows you to experience interactive programming and has some interesting features:
1. The semicolon can be omitted at the end of the statement.
2. Generally, it is not necessary to forcibly capture the checked exceptions.
3. You can directly write an expression.
4. other methods or variables can be referenced when defining methods, and these methods or variables can be defined after a period of time;
5. Others
Install JDK 9 and download
You can download the following link:
Https://jdk9.java.net/download/
Http://down.downun.com/%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/java/
I downloaded jdk-9-ea0000140_windows-x64_bin.exe;
Install
Very simple, click Install directly, remember to check the custom, select a suitable installation path, I installed in D: \ ProgramFiles \ Java \ jdk-9
Set Environment Variables
You can configure JAVA_HOME, PATH, CLASSPATH or something on the internet. If you only want to try Jshell, you can also choose not to set it;
Use Jshell
Directly under the binfile folder of the JDK installation directory, double-click jshell.exe.
Create a class and call a static method
Note that you can directly run the program without writing the main method.
Other examples
Enter/help for help
Did you find that it is very similar to the Python interpreter? You may want to explore the rest.
References
Http://www.importnew.com/16353.html
Http://www.journaldev.com/9879/java9-install-and-repl-jshell-tutorial