หลายภาษามีเครื่องมือแบบนี้เช่น python ถึงคิวจาวา มาใน java 9
REPL สะดวกดีประหยัดเวลาในการจะลองเขียนโค้ดทดสอบสั้นๆ หรือเป็น Console เมื่อต้องการสอนเขียนโปรแกรมก็ได้
pairoch@microbrainLAB:/opt$ jshell -v | Welcome to JShell -- Version 11.0.9.1 | For an introduction type: /help intro jshell> int i =0; i ==> 0 | created variable i : int jshell> /list 1 : int i =0; jshell> int b =10; b ==> 10 | created variable b : int jshell> /list 1 : int i =0; 2 : int b =10; jshell> System.out.orintln("Hello"); | Error: | cannot find symbol | symbol: method orintln(java.lang.String) | System.out.orintln("Hello"); | ^----------------^ jshell> System.out.println("Hello"); Hello jshell> System.out.println("REsult: "+ i+b ); REsult: 010 jshell> System.out.println("REsult: "+ (i+b) ); REsult: 10 jshell> int result = i+b; result ==> 10 | created variable result : int jshell> System.out.println("REsult: "+ result ); REsult: 10 jshell> /list 1 : int i =0; 2 : int b =10; 3 : System.out.println("Hello"); 4 : System.out.println("REsult: "+ i+b ); 5 : System.out.println("REsult: "+ (i+b) ); 6 : int result = i+b; 7 : System.out.println("REsult: "+ result ); jshell> void helloJShell(int i){ ...> for (int x =0; x<i; x++) System.out.println("HEllo "+x); ...> } | created method helloJShell(int) jshell> /list 1 : int i =0; 2 : int b =10; 3 : System.out.println("Hello"); 4 : System.out.println("REsult: "+ i+b ); 5 : System.out.println("REsult: "+ (i+b) ); 6 : int result = i+b; 7 : System.out.println("REsult: "+ result ); 8 : void helloJShell(int i){ for (int x =0; x<i; x++) System.out.println("HEllo "+x); } jshell> helloJShell(3) HEllo 0 HEllo 1 HEllo 2 jshell> helloJShell(4); HEllo 0 HEllo 1 HEllo 2 HEllo 3 jshell> /list 1 : int i =0; 2 : int b =10; 3 : System.out.println("Hello"); 4 : System.out.println("REsult: "+ i+b ); 5 : System.out.println("REsult: "+ (i+b) ); 6 : int result = i+b; 7 : System.out.println("REsult: "+ result ); 8 : void helloJShell(int i){ for (int x =0; x<i; x++) System.out.println("HEllo "+x); } 9 : helloJShell(3) 10 : helloJShell(4); jshell> helloJShell(result) HEllo 0 HEllo 1 HEllo 2 HEllo 3 HEllo 4 HEllo 5 HEllo 6 HEllo 7 HEllo 8 HEllo 9 jshell> helloJShell(12) HEllo 0 HEllo 1 HEllo 2 HEllo 3 HEllo 4 HEllo 5 HEllo 6 HEllo 7 HEllo 8 HEllo 9 HEllo 10 HEllo 11 jshell> if (result < 10)System.out.println("result less than 10"); jshell> /list 1 : int i =0; 2 : int b =10; 3 : System.out.println("Hello"); 4 : System.out.println("REsult: "+ i+b ); 5 : System.out.println("REsult: "+ (i+b) ); 6 : int result = i+b; 7 : System.out.println("REsult: "+ result ); 8 : void helloJShell(int i){ for (int x =0; x<i; x++) System.out.println("HEllo "+x); } 9 : helloJShell(3) 10 : helloJShell(4); 11 : helloJShell(result) 12 : helloJShell(43) 13 : if (result < 10)System.out.println("result less than 10"); jshell> if (result == 10)System.out.println("ryes"); ryes jshell> helloJShell(5) HEllo 0 HEllo 1 HEllo 2 HEllo 3 HEllo 4 jshell> /import | import java.io.* | import java.math.* | import java.net.* | import java.nio.file.* | import java.util.* | import java.util.concurrent.* | import java.util.function.* | import java.util.prefs.* | import java.util.regex.* | import java.util.stream.* jshell> /exit | Goodbye pairoch@microbrainLAB:/opt$