JShell คือ REPL เครื่องมือที่เปิดตัวใน Java 9 เราสามารถใช้เครื่องมือนี้เพื่อรันตัวอย่างอย่างง่ายใน บรรทัดคำสั่ง พร้อมรับคำ
เมื่อเราป้อนนิพจน์ทางคณิตศาสตร์ , ตัวแปร ฯลฯ ใน JShell จากนั้นจะแสดงผลลัพธ์โดยไม่มีรายละเอียดของประเภทของตัวแปรที่สร้างขึ้น เป็นไปได้ใน JShell ที่จะแสดงข้อมูลเพิ่มเติมเกี่ยวกับการดำเนินการของคำสั่งที่ป้อน ใช้ โหมด verbose . เราจำเป็นต้องได้รับข้อมูลเพิ่มเติมเกี่ยวกับคำสั่งที่ดำเนินการโดยใช้คำสั่ง:"/set feedback verbose " (คำสั่งนำหน้าด้วย "/ ")
ในตัวอย่างด้านล่าง โหมด 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