Search in sources :

Example 1 with Snippet

use of jdk.jshell.Snippet in project jdk9-jigsaw by AdoptOpenJDK.

the class JShellSample1 method main.

public static void main(String[] args) {
    JShell shell = JShell.builder().idGenerator((snippet, integer) -> "MyID" + integer).build();
    shell.eval("int a = 100;");
    shell.eval("100 + 100;");
    shell.variables().forEach(v -> System.out.println(v.typeName() + " " + v.name() + " " + v.id()));
}
Also used : JShell(jdk.jshell.JShell) Snippet(jdk.jshell.Snippet) JShell(jdk.jshell.JShell)

Aggregations

JShell (jdk.jshell.JShell)1 Snippet (jdk.jshell.Snippet)1