Complete the code to declare an integer array of size 5.
int[] numbers = new int[[1]];The code declares an integer array named numbers with 5 elements.
Complete the code to access the third element of the array.
int third = numbers[[1]];Array indexes start at 0, so the third element is at index 2.
Fix the error in the code to correctly print all elements of the array.
for (int i = 0; i < numbers.[1]; i++) { System.out.println(numbers[i]); }
In Java, arrays use length without parentheses to get their size.
Fill both blanks to create an array of squares for numbers 1 to 5.
int[] squares = new int[5]; for (int [1] = 0; [2] < 5; [1]++) { squares[[1]] = ([1] + 1) * ([1] + 1); }
The variable i is used as the loop counter to fill the array.
Fill all three blanks to create a new array with elements doubled from the original.
int[] doubled = new int[numbers.[1]]; for (int [2] = 0; [2] < numbers.length; [2]++) { doubled[[2]] = numbers[[2]] [3] 2; }
The new array size matches the original's length. The loop uses i as index, and each element is multiplied by 2.
