Arrays in Scala are mutable.
val myArray = Array.fill[String](3)(null)
// myArray is Array(null, null, null)
myArray(1) = "1"
// myArray is now Array(null, 1, null)
If you want an immutable replacement for the Array, look at the Vector:
val myVec = Vector.fill[String](3)(null)
// myVec is Vector(null, null, null)
myVec.updated(1, "1") // returns NEW Vector(null, 1, null)
// here myVec is still Vector(null, null, null)
Note, that updating Vector is slower than mutating the Array, that is the price of immutability.
Another alternative is to use an immutable ArraySeq in (scala 2.13):
val myArrSeq = ArraySeq.fill[String](3)(null)
// myArrSeq is ArraySeq(null, null, null)
myArrSeq.updated(1, "1") // returns NEW ArraySeq(null, 1, null)
// myArrSeq is still ArraySeq(null, null, null)
It behaves the same way as Vector does, and is backed by plain array internally, but, (important!), each update copies the whole sequence ( O(N) ), which is not acceptable in most scenarios.
Also, check this related question.