0
How is this code not modified? Java Language
int[] intList = new int[10]; for(int item : intList){ item = 17; }
1 Answer
+ 2
Because it is an enhanced for loop and item is a value type not reference type
Do this:
for(int i = 0; i < intList.length; i++){
intList [i] = 17;
}