Boolean Expression Evaluation in Java
        Posted  
        
            by Trilok
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Trilok
        
        
        
        Published on 2009-11-15T05:26:55Z
        Indexed on 
            2010/03/21
            15:11 UTC
        
        
        Read the original article
        Hit count: 585
        
Hey everyone, Is there a relatively simpler (when compared with writing a parser) way to evaluate boolean expressions in Java? I do not want to use the JEP library. I have a String expression something like: (x > 4 || x < 8 && p > 6) [ I will replace the variables with values. Is there a way by which I can evaluate this expression?
The problem is, this can be any level deep. So, writing a parser would be really complex.
Thanks
© Stack Overflow or respective owner