Java 9 in action - JShell - Ubuntu

Lets insatall the jdk on Ubuntu 16  :

apt-get install openjdk-9-jre

Java introduced a new tool JShell :

user@CT100:~# jshell
| Welcome to JShell -- Version 9-internal
| For an introduction type: /help intro


-> 2 + 3 + 8 * 5
| Expression value is: 45
| assigned to temporary variable $1 of type int

-> $1 + 10
| Expression value is: 55
| assigned to temporary variable $2 of type int

-> $1 + $2
| Expression value is: 100
| assigned to temporary variable $3 of type int

->

 

Just like typing a command to a console, this will make a lot easier to test small code , we can instantiate Objects and call methods, even declare functions.

Category: Java Tutorials