Loading topic
jshell on your PATH, and that you know basic Java expressions and types. It builds on starting and exiting a session. After reading it, you will know when JShell creates a scratch variable, how the variable gets its name and type, and which input5 min read/ as a command to the tool itself, not as Java. Commands inspect what the session holds, remove snippets, save your work and reset state. This chapter assumes you can start JShell, enter expressions, and declare variables and methods as snippets.5 min readimport statement does. Here you will see which packages JShell imports for you, how to add more, and how to fix the "cannot find symbol" errors that appear when an import is missing.4 min readcreated and modified. It covers how to declare methods without a class, how JShell identifies a method, and how redefinition affects other code in the session.4 min readtry/catch syntax and the difference between checked and unchecked exceptions.4 min read/list and /vars. It covers three things: Tab completion, the line-editing keys at the prompt, and the /edit command for changing earlier snippets.4 min read/vars and /list. You need JDK 9 or later. The sample output was written for recent JDKs, so exact wording may differ slightly on yours.4 min readjshell on the PATH. By the end, you will be able to run a script file, save a session to a file, reload it later, and avoid the common pr5 min read/list and /vars, and load a script file. It uses JDK 11 or later. The startup options shown here exist in JDK 9, but a few details differ there.5 min read.java file, what causes the differences, and how to decide between JShell and a compiled pr5 min readjshell tool (snippets, slash commands, forward references) and can write ordinary Java with try-with-resources, streams and List. You need JDK 9 or later.4 min read