boolean x = a=true || (b = true) && (c = true);
System.out.println(a + "," + b + "," + c);
boolean x = a=true && (b = true) || (c = true);
System.out.println(a + "," + b + "," + c);
Hello all,
I am preparing for the
SCJP exam. I am confused with the concept discussed here. Looks like according to the question posted, precedence doesn't make any difference. It is true, if the two operators have the same level of precedence, it is evaluated from left to right. But here the && operator has higher precedence over the || operator, so the expression should be evaluated in a hierarchical order.Which means the && operator should be evaluated first and then the || operator. But it seems like in both the situations it is evaluated from right to left. So could you please explain what is happening here.
Thank you very much.....