import java.util.Scanner;
import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException;
public class test6 {
public static void main(String[] args) throws Exception { ScriptEngineManager se =new ScriptEngineManager(); ScriptEngine s = se.getEngineByName("JavaScript"); Object oj=s.eval("function add(a,b){return a+b};add(2,4)"); System.out.println(oj); }
}