Reputation: 108
For example, how would one make sense of (true && false || (53 < 24));
?
I'm aware that it evaluated to false I'm just curious as to how I would figure that out step by step.
Thanks!
Upvotes: 1
Views: 39
Reputation: 159155
You check a handy Java Operator Precedence table, which shows that &&
has higher precedence than ||
, meaning that the expression is equivalent to:
((true && false) || (53 < 24))
Then you start evaluating:
((true && false) || (53 < 24))
↓
( false || (53 < 24))
↓
( false || false )
↓
false
Upvotes: 3