title: Meaning of final for Scala constructor arguments and class/trait/object members
body: <p>What does <code>final</code> mean for Scala constructor arguments? I have this example:</p>
  
  <pre><code>class IntFinalTest(
      val intVal: Int,
      final val finalIntVal: Int,
      var intVar: Int,
      final var finalIntVar: Int) {
    //  intVal = 3 // error: reassignment to val
    //  finalIntVal = 3 // error: reassignment to val
    intVar = 3
    finalIntVar = 3
  }
  
  class ArrayFinalTest(
      val arrayVal: Array[Int],
      final val finalArrayVal: Array[Int],
      var arrayVar: Array[Int],
      final var finalArrayVar: Array[Int]) {
    arrayVal(0) = 3
    finalArrayVal(0) = 3
    arrayVar(0) = 3
    finalArrayVar(0) = 3
  }
  </code></pre>
  
  <p>Judging by the compiler output (only the two marked lines result in an error), there is no difference between <code>final</code> and non-<code>final</code> <code>val</code>s and <code>var</code>s - is this correct? I have verified by running this example that all variables except for <code>intVal</code> and <code>finalIntVal</code> do get modified. </p>
  
  <p><strong>Related question RQ1</strong>: Does <code>final</code> have any significance in constructors of classes that are part of a hierarchy?</p>
  
  <p><strong>Related question RQ2</strong>: How do I create an immutable <code>Array[Int]</code> class member if it's part of constructor argument list?</p>
  
  <p>Context: I use Scala 2.10.5 and only have a few months of experience with it. </p>