title: Java double checked locking - Strings
body: <p>Given that <code>string</code>s contain final field, does it mean in the context of double checked locking it is not necessary to declare them <code>volatile</code>? E.g.</p>
  
  <pre><code>class SomeClass{
       private String val;
  
       String getVal(){
             if(val == null){
                  synchronized(this){
                        if(val ==null)
                             val = new String("foo");
                  }
            }
       }
  }
  </code></pre>
  
  <p>I used a string as an example, but it should work with other objects that declare some final field, correct?</p>