19 August 2015

Java 9 JShell


Jshell (developed in project Kulla) is a java shell allowing you to type java instructions at the shell prompt and have them executed.

  • if jshell detects a complete statement even without a closing semicolon
  • you can type an expression which will be evaluated 
-> 2 + 2
| Expression value is: 4
| assigned to temporary variable $1 of type int
  • you are not obliged to catch exceptions
  • you can save and load your command history
  • you can use methods and references that will only be defined later
-> double volume(double radius) {
>> return 4.0 / 3.0 * PI * cube(radius);
>> }
| Added method volume, however, it cannot be invoked until method cube(double), and variable PI
are declared
  • you can list current variables, methods...
  •  tab completion as you type
Here's a small tutorial.

No comments:

Post a Comment