title: Which is the difference between AtomicReference and Synchronized?
body: <p>Is there any difference between AtomicReference and Synchronized?<br>
  E.G.</p>
  
  <pre><code>public class Internet {
      AtomicReference&lt;String&gt; address;
      public String getAddress(){
          return address.toString();
      }
      public void setAddress(String address) {
          this.address.set(address);
      }
  
  }
  </code></pre>
  
  <p>And I pass the class to some threads that try to use the class at the same time, is it the same thing if I use this:</p>
  
  <pre><code>public class Internet {
      String address;
      public String getAddress(){
          return address;
      }
      public void setAddress(String address) {
          this.address = address;
      }
  }
  </code></pre>
  
  <p>And then in the thread use <code>synchronized</code> before access to the class?</p>