Couldn't really figure out/find what a difference between thouse two
import groovy.lang.Binding;
import groovy.lang.GroovyShell;
class Scratch {
public static void main(String[] args) {
Binding binding = new Binding();
Integer p = 1,
v = 1;
binding.setProperty("p", p);
binding.setVariable("v", v);
GroovyShell shell = new GroovyShell(binding);
shell.evaluate("p++;v++;");
System.out.println(String.format("BINDING Property = %s, Variable = %s", binding.getProperty("p"), binding.getVariable("v")));
System.out.println(String.format("JAVA Property = %s, Variable = %s", p, v));
}
}
Run Code Online (Sandbox Code Playgroud)
Output is:
BINDING Property = 2, Variable = 2
JAVA Property = 1, Variable = …Run Code Online (Sandbox Code Playgroud)