title: Java boolean expression concurrency behavior
body: <p>Please consider the following situation.
  There are two <code>AtomicInteger</code> fields in some class:</p>
  
  <pre><code>private final AtomicInteger first = new AtomicInteger();
  private final AtomicInteger second = new AtomicInteger();
  </code></pre>
  
  <p>Then I have something like this:</p>
  
  <pre><code>boolean equal = first.get() == second.get();
  </code></pre>
  
  <p>So the question is how exactly this expression is evaluated? Can variables change values during its evaluation? For example is it possible that both <code>first</code> and <code>second</code> variables are equal when we start to evaluate the expression, but between evaluation of <code>first.get()</code> and <code>second.get()</code> some of them changes so <code>equal</code> evaluates to <code>false</code>? Or the expression is evaluated atomically by comparing snapshots of the variables on invocation?</p>
  
  <p>Thanks in advance!</p>