I was surprised to see that the following Java code snippet compiled and ran:
for(final int i : listOfNumbers) {
System.out.println(i);
}
where listOfNumbers is an array of integers.
I thought final declarations got assigned only once. Is the compiler creating an Integer object and changing what it references?