直接能够穿一个字符串执行


private static void test(String pm1) {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
Object result;
try {
result = engine.eval(pm1);
System.out.println("a + b = " + result);
} catch (ScriptException e) {
e.printStackTrace();
}
}







改编于:http://blog.csdn.net/sdyy321/article/details/6959199


相关文章:

  • 2022-12-23
  • 2021-09-10
  • 2022-01-11
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案