mercredi 14 septembre 2016

How to retrieve String value as a condition for if statment in java?

I tried to do something like this but becasue getCondition will return me a string value the If statment throws error because it expect to have a boolean value.. is there is any way to retrieve and execute the String inside the if statment?

Private String condition = "age < 18";
String getCondition(){return this.condition;}

if(getCondition())
{....}

Aucun commentaire:

Enregistrer un commentaire