import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class ScriptEngineTest {
public static void main(String[] args) {
ScriptEngineManager sem = new ScriptEngineManager();
ScriptEngine se = sem.getEngineByName("js");
try {
System.out.println(se.eval("1+2*(3+4)").toString());
} catch (ScriptException e) {
e.printStackTrace();
}
}
}
ScriptEngine
最新推荐文章于 2021-09-04 17:49:50 发布