title: How to turn this string to double without error i want to get double number
body: <p>Here is the code bellow is where is the error thrown here is the error:
  java.lang.Integer cannot be cast to java.lang.Double</p>
  
  <pre><code>package swing3;
  
  import javax.script.ScriptEngine;
  import javax.script.ScriptEngineManager;
  import javax.script.ScriptException;
  
  public class rob {
  public static void main(String[] args) {
      ScriptEngineManager mgr = new ScriptEngineManager();
       ScriptEngine engine = mgr.getEngineByName("JavaScript");
  </code></pre>
  
  <p>Here i got an error:</p>
  
  <pre><code>     String a = "3+5";
       try {
          double b = (Double)engine.eval(a);
          System.out.println(b);
      } catch (ScriptException e) {
          e.printStackTrace();
      }
  
  }
  
    }
  </code></pre>