I am learning java, I just want to make sure I am understand this line of code properly. It is as follows:
public class DataStructure {
private final static int SIZE = 15;
private int[] arrayOfInts = new int[SIZE];
public DataStructure() {
for (int i = 0; i < SIZE; i++) {
arrayOfInts[i] = i;
}
}
The line I am not sure about is:
arrayOfInts[i] = i;
Is this saying that in the array, index 0 will produce an int value of 0, and index 2 will produce an int value of 2, and so on...?
i
to that position in the array. After the loop, your array will be{0,1,2,3,4,...,13,14}
.