Hi all,
Can any one tell me what is the equivalent of
eval function ( this is a function in javascript ) in java. The requirement is to evaluate the value of an expression but the expression is itself a string.
Example
ClassA a = new ClassA();
String strExpression = "a.getName()" ;
Now I want to print the value returned by a.getName(). Is there any function ftn such that
System.out.println(ftn(strExpression)) would print the value returned by a.getName()
Thanks
[ June 04, 2002: Message edited by: Pradyumna Hari ]
Can any one tell me what is the equivalent of
eval function ( this is a function in javascript ) in java. The requirement is to evaluate the value of an expression but the expression is itself a string.
Example
ClassA a = new ClassA();
String strExpression = "a.getName()" ;
Now I want to print the value returned by a.getName(). Is there any function ftn such that
System.out.println(ftn(strExpression)) would print the value returned by a.getName()
Thanks
[ June 04, 2002: Message edited by: Pradyumna Hari ]