Java Tools Tutorials - Herong's Tutorial Examples - v6.23, by Herong Yang
jshell - Entering Expressions and Statements
This section provides a tutorial example on how to start 'jshell' and enter expressions and statements.
As the first test, I want to start "jshell" and enter a few Java expressions and Java statements:
herong> jshell | Welcome to JShell -- Version 12.0.1 | For an introduction type: /help intro jshell> Math.PI*0.5*0.5; $1 ==> 0.7853981633974483 jshell> System.out.println("Hello World!"); Hello World! jshell> String x = "Apple", y = "Orange"; x ==> "Apple" y ==> "Orange" jshell> int s = 0; s ==> 0 jshell> for (int i=1; i<=100; i++) {s += i;}; jshell> s; s ==> 5050 jshell> class Hello { ...> public static void print () { ...> System.out.println("Aloha!"); ...> } ...> } | created class Hello jshell> Hello.print(); Aloha! jshell> /exit | Goodbye (1)
Cool. "jshell" is easy to use.
Table of Contents
javac - The Java Program Compiler
java - The Java Program Launcher
jpackage - Binary Package Builder
javadoc - The Java Document Generator
jdeps - The Java Class Dependency Analyzer
jdeprscan - The Java Deprecated API Scanner
jcmd - The JVM Diagnostic Tool
jconsole - Java Monitoring and Management Console
jstat - JVM Statistics Monitoring Tool
jhsdb - The Java HotSpot Debugger
jvisualvm (Java VisualVM) - JVM Visual Tool
javap - The Java Class File Disassembler
keytool - Public Key Certificate Tool
►jshell - Entering Expressions and Statements
"jshell> /save" - Saving Code Snippet
"jshell> /edit" - Editing Code Snippet
jrunscript - Script Code Shell
native2ascii - Native-to-ASCII Encoding Converter