Let's say I have the following,
public class Foo{
private String bar;
public String getBar(){
return bar;
}
public void setBar(String bar){
this.bar = bar;
}
}
Are these methods automatically threadsafe due to the immutable nature of the String
class, or is some locking mechanism required?