There is an instance field:
private int[] arr = new int[42]; I use the code:
for (int cell : arr) { cell = -1; } I hoped that this code would fill the array with -1 elements. This did not happen. The array is still zeros.
Please explain why this happened. What code is the foreach loop equivalent in this case?