title: Question about Scala variable Mutability
body: <p>I understand that <strong>val</strong> keyword determines the underlying variable is a Immutable type (Cannot be reassigned later time). Now i come across a paragraph in programming in scala (Chapter 3, Next steps in scala - parameterize arrays with types), it states</p>
  
  <pre><code>val greetStrings: Array[String] = new Array[String](3)
  greetStrings(0) = "Hello"
  greetStrings(1) = ", "
  greetStrings(2) = "world!\n"
  </code></pre>
  
  <blockquote>
    <p>These three lines of code illustrate
    an important concept to understand
    about Scala concerning the meaning of
    val. When you define a variable with
    val, the variable can’t be reassigned,
    but the object to which it refers
    could potentially still be changed. So
    in this case, you couldn’t reassign
    greetStrings to a different array;
    greetStrings will always point to the
    same Array[String] instance with which
    it was initialized. But you can change
    the elements of that Array[String]
    over time, so the array itself is
    mutable.</p>
  </blockquote>
  
  <p>so its valid to change the elements of array. And its invalid if we define like this</p>
  
  <pre><code>greetStrings = Array("a","b","c")
  </code></pre>
  
  <p>It satisfies the below statement</p>
  
  <blockquote>
    <p>When you define a variable with
    val, the variable can’t be reassigned,
    but the object to which it refers
    could potentially still be changed.</p>
  </blockquote>
  
  <p>but if i declare something like this</p>
  
  <pre><code>val str = "immutable string"
  </code></pre>
  
  <p>By the definition given in the book</p>
  
  <p>what it means <strong>object to which it refers could potentially still be changed</strong> in the above line of code ??</p>