title: Immutable objects are thread safe, but why?
body: <p>Lets say for example, a thread is creating and populating the reference variable of an immutable class by creating its object and another thread kicks in before the first one completes and creates another object of the immutable class, won't the immutable class usage be thread unsafe?</p>
  <p>Creating an immutable object also means that all fields has to be marked as final.</p>
  <blockquote>
  <p>it  may  be necessary  to  ensure  correct  behavior if a reference to
  a newly created instance is passed from one thread to another without
  synchronization</p>
  </blockquote>
  <p>Are they trying to say that the other thread may re-point the reference variable to some other object of the immutable class and that way the threads will be pointing to different objects leaving the state inconsistent?</p>