title: Unsafe publication concurrency java
body: <p>Java concurrency in practice book has given an example for unsafe publication</p>
  
  <pre><code>public class Holder 
  {
      private int n;
      public Holder(int n)
      {
          this.n = n; 
      }
      public void assertSanity() 
      {
          if (n != n)
              throw new AssertionError("This statement is false.");
      }
  }
  </code></pre>
  
  <p>The above code seems to be thread safe. It would not be thread safe if n is public variable. Is the book example wrong? </p>