title: Does a "private" modifier also ensure Thread safety in Java
body: <p>Reading through <a href="http://www.ibm.com/developerworks/java/library/j-jtp0618/index.html#ibm-pcon" rel="nofollow">this</a> excellent article about safe construction techniques by Brain Goetz, I got confused by a comment given inside the listing 5. Here is the code snippet:</p>
  
  <pre><code>public class Safe { 
  
   private Object me;
   private Set set = new HashSet();
   private Thread thread;
  
   public Safe() { 
   // Safe because "me" is not visible from any other thread
   me = this;
  
  // Safe because "set" is not visible from any other thread
   set.add(this);
  
  // Safe because MyThread won't start until construction is complete
  // and the constructor doesn't publish the reference
     thread = new MyThread(this);
  }
  
  public void start() {
     thread.start();
   }
  
  private class MyThread(Object o) {
  
  private Object theObject;
  
  public MyThread(Object o) { 
    this.theObject = o;
  }
  
  ...
   }
  }
  </code></pre>
  
  <p>Why does he say this about <code>me</code> ? <code>// Safe because "me" is not visible from any other thread</code>. Can't two threads simultanouesly access the instance variable <code>me</code>?</p>