Presumably, the compiler optimizes this, as always false, but if not, then yes, in a multi-threaded environment, it can return true.
Suppose that n on the left is copied to register a. Then the current thread is interrupted, the next thread changes n, then we return to the first thread. Now the right-hand side of n is copied to the register, and then the comparison operation is performed (in two registers).
In this case, they will be different.
EDIT: if you look at the bytecode in the nhantdh comment below, you will see that two loads are performed on n, so an interrupt with a modification between them can cause the expression to be true.
par
source share