July 2017
Intermediate to advanced
466 pages
11h 24m
English
One change that seems to excite a lot of people isn't a language change at all. It's the addition of a REPL (Read-Eval-Print-Loop), a fancy term for a language shell. In fact, the command for this new tool is jshell. This tool allows us to type or paste in Java code and get immediate feedback. For example, if we wanted to experiment with the Streams API discussed in the preceding section, we could do something like this:
$ jshell | Welcome to JShell -- Version 9-ea | For an introduction type: /help intro jshell> List<String> names = Arrays.asList(new String[]{"Tom", "Bill", "Xavier", "Sarah", "Adam"}); names ==> [Tom, Bill, Xavier, Sarah, Adam] jshell> names.stream().sorted().forEach(System.out::println); Adam Bill Sarah Tom Xavier ...Read now
Unlock full access