---------
public class Test{
public static void main(
String[] args}{
boolean b1 = true;
boolean b2 = false;
boolean b3 = true;
if(b1 & b2 | b2 | b3 & b2) //if1 statement
System.out.print("pig");
if(b1 & b2 | b2 & b3 | b2 |b1) //if2 statement
System.out.println("pen");
}//end main
}//end Test
------------
here's what the answer or reference button provides:
"
The answer is "pen". That's the output. The 'reference button'/tip, says "pig" is not output because it doesn't resolve to true.
\
if(b1 & b2 | b2 | b3 & b2) //if1 statement
So this is more like : (b1 & b2) = false, and next due to order of precednce (b3 & b2), then what??? the statements ends because that was the last of the comparisons within the if statement parentheses, or does it next evaluate OR (|) b2 (the middle b2) as = false as well, which is why it's false?
Basically, does the b2 in the middle get evaluated by itself as an | after the two &s are evaluated? Or (no pun intended), does the evaluation close with the last b3&b2 evaluation?
If the middle b2 is being evaluated lastly, is it looked at like from left to right...for instance ((b3&b2 = false) | b2)=false? Or like a lone ranger, not tied to the pre or post & comparisons? Or, if the middle b2 is evaluated, is it evaluted as b2|b2 (first and second b2's, then b2|b3 (second b2 and last b3)?
[ June 01, 2007: Message edited by: Michael Raymond Jr. ]