title: Volatile or synchronized for primitive type?
body: <p>In Java, assignment is atomic if the size of the variable is less than or equal to 32 bits but is not if more than 32 bits.</p>
  
  <p>What (volatile/synchronized) would be more efficient to use in case of double or long assignment?</p>
  
  <p>Like,</p>
  
  <pre><code>  volatile double x = y;
  </code></pre>
  
  <p>synchronized is not applicable with primitive argument. How do I use synchronized in this case? Of course I don't want to lock my class, so <code>this</code> should not be used.</p>