Dynamic if statement evaluation problem with string comparison
<p>I tried the example given in <a href="http://forums.sun.com/thread.jspa?threadID=780576&amp;tstart=67605" rel="nofollow">this thread</a>
to create if statement dynamically using <a href="http://www.beanshell.org/home.html" rel="nofollow">BeanShell</a>. But it is not working fine. Instead of using "age" variable as integer, i have used string in the below example. I am getting "fail" as answer instead of "success".</p>

<p>Can anyone help me?</p>

<pre><code>/*
To change this template, choose Tools | Templates
and open the template in the editor.
*/

import java.lang.reflect.*;
import bsh.Interpreter;

public class Main {
  public static String d;

  public static void main(String args[])
  {
    try {
      String age = "30";

      String cond = "age==30";


      Interpreter i = new Interpreter();

      i.set("age", age);

      System.out.println(" sss" + i.get("age"));

      if((Boolean)i.eval(cond)) {
        System.out.println("success");
      } else {
        System.out.println("fail");
      }
    }
    catch (Throwable e) {
      System.err.println(e);
    }
  }
}
</code></pre>

<p>Thanks,
Mani </p>
