Which is the difference between AtomicReference and Synchronized?
问题 Is there any difference between AtomicReference and Synchronized? E.G. public class Internet { AtomicReference<String> address; public String getAddress(){ return address.toString(); } public void setAddress(String address) { this.address.set(address); } } 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: public class Internet { String address; public String getAddress(){ return address; } public void setAddress(String address