class Question { public static void main(String[] args) { int x = 1; boolean b1,b2,b3,b4; b1=b2=b3=b4=true; x=(b1 | b2 & b3 ^ b4) ? x++ : --x; System.out.println(x); } }
When I run this code I get 1 as answer I thought The expression in braces give false and so --x will get executed and we will get 0.CAn someone explain.
[This message has been edited by Sam Wong (edited January 17, 2001).]
Mindy Hudson
Greenhorn
Joined: Dec 08, 2000
Posts: 28
posted
0
sam the link was real useful
Vladimir Kositsky
Ranch Hand
Joined: Nov 03, 2000
Posts: 116
posted
0
There is expression: Ulcer______Unary Addicts____Arithmetic and shift Really_____Relational Like_______Logical and bitwise C__________conditional A lot______Assignments Hope it helps [This message has been edited by Vladimir Kositsky (edited January 17, 2001).]