Because in your enhanced for loop, the variable n is a local variable which is reassigned to a new String returned from n.replace("\"", "") and doesn't affect the value stored in the List. The loop is functionally equivalent toYou can easily see that this won't change the value of the String at names.get(i).
There are no new questions, but there may be new answers.
On a side note, Java 5.0 added varargs and that's enabled for Arrays.asList too. So you can also write the following:
In the background the exact same thing happens, but this is easier to read and write.