You seem to confuse how Boolean.parseBoolean
works. The javadoc clearly states that:
The boolean returned represents the value true if the string argument
is not null and is equal, ignoring case, to the string "true".
I.e. only expressions like Boolean.parseBoolean("True")
or Boolean.parseBoolean("tRuE")
return true, there is no argument evaluation done like for example in Javascript's eval()
(although you can use the ScriptEngine in Java).
See this example:
public static void main (String[] args) throws java.lang.Exception
{
String ad ="1<2";
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
Object result = engine.eval(ad);
System.out.println(Boolean.TRUE.equals(result)); // true
}