The scripts are executed by calling eval on an instance of ScriptEngine interface.
We get an instance of ScriptEngine by using an instance of ScriptEngineManager. An instance of ScriptEngineManager is used to lookup and return a instance of ScriptEngine. It also holds one or more instance of ScriptEngines created by it in a collection. We can get an instance of ScriptEngine using the method “getEngineByName” on ScriptEngineManager as shown below