on line 1
we initialize the variable assiging it to a string collection.
on line 4
we call each method on a
object assigned to the object collection pointing to a
.
on line 5
as we the variable is shadowing each specific objects 'a','b', 'c'
will be modified to upcase(if we will try to call a.upcase!
out of the block we will raise an exception).
on line 6
we modify again each object, but the array is the same, so we can't modify the array
on line 9
the return value is => ['Ad','Bd','Cd']
because we modify each object inside the collection but not the array the concept of variable shadowing is also applied in case will not be applied we will have a => ['A','d','C']