As this post (Is there something like python's interactive REPL mode, but for Java?) shows, we can use groovysh
for Java REPL.
I have this code that compiles well with javac
.
GroovyShell shell = new GroovyShell();
shell.evaluate("println \"My name is ${name}\"");
However, when I tried to run this command in the groovysh
, I got error. I had to make \${name}
to bypass the error.
Why is this? What other possible (corner) cases that Java and Groovy code be different?