title: ScriptEngine works in java String, but fails in String[]
body: <p>The following code do the calculation for data in String rani=String rani =  "32*0.25"; and gives the correct output as 8.0</p>
  
  <pre><code>import javax.script.ScriptEngineManager;
  import javax.script.ScriptEngine;
  import javax.script.ScriptException;
  
  public class StringMathEngine {
  
      public static void main(String[] args) throws ScriptException {
  
          ScriptEngineManager mgr = new ScriptEngineManager();
          ScriptEngine engine = mgr.getEngineByName("JavaScript"); 
          String rani =  "32*0.25";
          System.out.println(engine.eval(rani));
      }
  }
  </code></pre>
  
  <p>But fails when it is employed in the following code:</p>
  
  <pre><code>import javax.script.ScriptEngineManager;
  import javax.script.ScriptEngine;
  import javax.script.ScriptException;
  
  public class StringMathEngine {
  
      public static void main(String[] args) throws ScriptException {
  
          ScriptEngineManager mgr = new ScriptEngineManager();
          ScriptEngine engine = mgr.getEngineByName("JavaScript");
  
  
  
          String[]rani = {"s", "32*0.25", "r", "32*0.75+16", "r", "16", "s", "32"};
  
          for(int n=0;n&lt;rani.length; n++){
              if(rani[n].equals("s")) {
                  rani[n]=rani[n].replaceAll("s","C/");
              }
  
              else if(rani[n].equals("r")){
                   rani[n]=rani[n].replaceAll("r","D/");
              } 
              else {
                   rani[n]=engine.eval(rani[n]);
              } 
  
              System.out.println(rani[n]);
          }
      }
  }
  </code></pre>
  
  <p>Being new to programming I need help to correct this code.</p>