This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> /help | |
| | Type a Java language expression, statement, or declaration. | |
| | Or type one of the following commands: | |
| | /list [<name or id>|-all|-start] | |
| | list the source you have typed | |
| | /edit <name or id> | |
| | edit a source entry referenced by name or id | |
| | /drop <name or id> | |
| | delete a source entry referenced by name or id | |
| | /save [-all|-history|-start] <file> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> /drop sayHello | |
| | dropped method sayHello(String) | |
| jshell> /edit HelloPrinter | |
| | modified class HelloPrinter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> String sayHello(String name) {return "hello "+ name;} | |
| | created method sayHello(String) | |
| jshell> sayHello("readers of the blog") | |
| $2 ==> "hello readers of the blog" | |
| jshell> /methods | |
| | String sayHello(String) | |
| jshell> class HelloPrinter{ public static void sayHello(){System.out.println("hello readers of the blog");}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> /l | |
| 1 : 1+1 | |
| 2 : int x = 1+1; | |
| 3 : System.out.println(x) | |
| 4 : Thread.sleep(5000) | |
| 5 : import java.time.*; | |
| 6 : ZonedDateTime.now() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> /vars | |
| | int $1 = 2 | |
| | int x = 2 | |
| | ZonedDateTime $7 = 2017-10-12T14:55:59.309666-04:00[America/Toronto] | |
| jshell> /list | |
| 1 : 1+1 | |
| 2 : int x = 1+1; | |
| 3 : System.out.println(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> ZonedDateTime.now() | |
| | Error: | |
| | cannot find symbol | |
| | symbol: variable ZonedDateTime | |
| | ZonedDateTime.now() | |
| | ^-----------^ | |
| jshell> import java.time.* | |
| jshell> ZonedDateTime.now() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> /imports | |
| | 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.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> Thread.sleep(5000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> System.out.println(x) | |
| 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> int x = 1+1 | |
| x ==> 2 |