O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

  1. Let's use jjs to execute the script, $ jjs hellojjs.js, which gives this output: Hello via JJS using Nashorn.
  2. Let's now try this with ECMAScript 6 features of using Set, Map, and template strings. A template string supports building a String with placeholders for dynamic values. A placeholder is identified by ${variable} and the complete String is embedded within ``. We run this script using the jjs --language=es6 using_map_set_demo.js command. By default, jjs runs in es5 mode and we enable it to run in es6 by giving this option, as shown in the following screenshot:
  1. Now, let's use the jjs tool interactively. Run $ jjs --language=es6 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required