如何在 Java 9 中在 JShell 中设置详细模式?
JShell 是 Java 9 中引入的 REPL 工具。我们可以使用此工具在命令行提示符中执行简单的代码段。
当我们在 JShell 中输入算术表达式、变量等时,它会显示结果,但不显示创建的变量的类型详细信息。可以在 JShell 中显示有关执行输入命令的更多信息,使用详细模式。我们需要使用命令来获取有关使用该命令执行的更多信息:“/set feedback verbose”(该命令可以前置“/”)。
在下面的代码段中,详细模式已开启,并且它能够显示有关变量类型的更多信息。
C:\Users\User>jshell
| Welcome to JShell -- Version 9.0.4
| For an introduction type: /help intro
jshell> /set feedback verbose
| Feedback mode: verbose
jshell> 5.0 * 8
$1 ==> 40.0
| created scratch variable $1 : double
jshell> String str = "TutorialsPoint";
str ==> "TutorialsPoint"
| created variable str : String
jshell> void test() {
...> System.out.println("Tutorix");
...> }
| created method test()
jshell> test()
Tutorix
jshell> String str1 = new String("Tutorix");
str1 ==> "Tutorix"
| created variable str1 : String
jshell> "TutorialsPoint" + "Tutorix" + 2019
$6 ==> "TutorialsPointTutorix2019"
| created scratch variable $6 : String
jshell> int test1() {
...> return 10;
...> }
| created method test1()
jshell> test1()
$8 ==> 10
| created scratch variable $8 : int
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言
C++
C#
MongoDB
MySQL
Javascript
PHP