[Logo]
Forums Register Login
Operator: & ^ |
I'm confused!!! I have compiled this code and I don't get the same results manually. Can someone please explain the following:
n = 7;
n = n & n + 1 | n + 2 ^ n + 3;
n = 57;
Here's how I'm figuring this out:
n = 7;
n = ( n & n ) + ( 1 | n ) + ( 2 ^ n ) + 3;
n = 56 + 57 + 58 + 3;
n = 174;
So, why isn't this right?
Thanks for the help!
 
Originally posted by Shannon Sims:

n = 7;
n = n & n + 1 | n + 2 ^ n + 3;

this will be executed as:

refer to Java Expressions
mavedrive;
Ahh...the order of precendence. Got it. Thanks!
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Dec 13, 2017 10:39:40.