0
Why does the output value of (a) change when you use the | operator instead of the operator || is used?
int a = 2; int b = 3; if ((a < b) || (++ a == b)) { System . out. println ("a = " + a); System . out. println ("b = " + b); } :::RESULT::: a = 2 b = 3 UNDERSTOOD but when: int a = 2; int b = 3; if ((a < b) | (++ a == b)) { System . out. println ("a = " + a); System . out. println ("b = " + b); } :::RESULT::: a = 3 b = 3 WHY? How is it calculated exactly, please?
2 Respuestas
0
First of all the result of the first code is a = 2, b = *4*.
And second if I understood this then it works as || operator but it doesn't stop if it already found a true part of the if statement.
0
can you tell me what does that" if((a<b)l(++a==b))"means