Sub topic 12
Choosing a Feedback Mode
Assume you already know basic Java syntax and can start a JDK 9-or-later jshell session. A feedback mode controls how much information JShell prints while it reads and evaluates your input. It does not change how Java code runs.
JShell has four built-in modes:
| Mode | Best use | Typical behavior |
|---|---|---|
| `normal` | Learning and everyday work | Shows prompts and useful result messages |
| `concise` | Faster experimentation | Reduces routine feedback |
| `verbose` | Debugging JShell behavior | Shows detailed feedback about declarations and evaluation |
| `quiet` | Scripts or minimal interaction | Suppresses most routine feedback |
The default mode is usually normal. Change it with the /set feedback command:
$ jshell
| Welcome to JShell -- Version 21
| For an introduction type: /help intro
jshell> /set feedback concise
jshell> 6 * 7
$1 ==> 42
jshell> /set feedback verbose
| Setting new options and restoring state.
jshell> int answer = 6 * 7
| created variable answer : int
jshell> /set feedback normal
| Setting new options and restoring state.
jshell> answer
answer ==> 42
jshell> /exit
| GoodbyeThe exact wording and prompt display can differ between JDK versions. The important distinction is that concise reduces routine messages, while verbose exposes more detail about what JShell created. normal is a useful balance when you are learning. quiet is useful when another program or script should produce most of the visible output.
Feedback does not hide program output
Feedback mode controls JShell’s own messages. It does not normally suppress text printed by your Java code:
System.out.println("Application output");This line still prints Application output in every feedback mode. A result such as 42, a declaration message, a prompt, and an exception report are different kinds of output. Choose a mode based on which of those you need to see.
Choosing a mode
Use normal when you need prompts, result variables, and confirmation that declarations succeeded. Use concise when repeated declarations make the session noisy. Switch temporarily to verbose when you are unsure whether JShell accepted a declaration, modified an existing method, or restored session state.
A feedback mode is session configuration. It does not alter the Java language, the class path, or the variables and methods already defined.
Exercise
Which feedback mode should you choose when debugging whether JShell created or modified a method, and how do you select it?
Show answer
Choose verbose and enter /set feedback verbose.