Why is x == (x = y) not the same as (x = y) == x?
问题 Consider the following example: class Quirky { public static void main(String[] args) { int x = 1; int y = 3; System.out.println(x == (x = y)); // false x = 1; // reset System.out.println((x = y) == x); // true } } I'm not sure if there is an item in the Java Language Specification that dictates loading the previous value of a variable for comparison with the right side ( x = y ) which, by the order implied by brackets, should be calculated first. Why does the first expression evaluate to