What is the value displayed by the following program?
class Question {
public static void main(
String[] args) {
int x = 0;
boolean b1, b2, b3, b4;
b1 = b2 = b3 = b4 = true;
x = (b1 | b2 & b3 ^ b4) ? x++ : --x;
System.out.println(x);
}
}
A. -1
B. 0
C. 1
D. 2
Ans : B (0)
I think Ans is C (1). I think its evaluated as
( b1 |(( b2 & b3) ^ b4 ) ) ? x++ : --x
Could some one make me this clear.
Thanks in advance
Rgds,
Benz.