Consider the following example:
class Quirky { public static void main(String[] args) { int x = 1; int y = 3; System.out.println(x =
In the first test you're checking does 1 == 3.
In the second test your checking does 3 == 3.
(x = y) assigns the value and that value is tested. In the former example x = 1 first then x is assigned 3. Does 1 == 3?
In the latter, x is assigned 3, and obviously it's still 3. Does 3 == 3?