This is as much of a precedence issue as it is the difference between short and "long" circuit operators. The short-circuit operators have a lower precedence, so the two expressions end up like so:
In the first expression, as the & operator is of higher precedence than |, the two falses get grouped together, but the entire expression results in a true value since "false | true" is true.
The second expression gives higher precedence to the | operator, so "false | true" get grouped together. Here, however, the short-circuit operator stops at the first false since it wouldn't matter what the second grouping would result in.
Hope this helps.
Joined: Nov 21, 2005
ah, I see... so it is a precedence issue. Will such things be in the Java 5 exam? Because in the K&B book, it says the operator precedence is not on the exam except for +- vs. */ (as far as I understood - so I didn't have a deeper look onto it). And now there comes along this example based on operator precedence... does that mean its important after all?
Anyway, I suppose it would not be much effort learning it by heart... [ February 22, 2006: Message edited by: Tilo Hemp ]