Operator precedence in Java with assignment

63 Views Asked by At

Can anyone help me understand the logic behind the following results?

Case 1.

int x,a = 100;
x = a + (a=6);
System.out.println(x);  //prints 106

Case 2.

int x,a =100;
x = (a=6) + a;
System.out.println(x);  //prints 12

why a=6 not evaluate first in 1st case

0

There are 0 best solutions below