Complete the code to declare an integer array named numbers with size 5.
int[] numbers = new int[[1]];The code declares an integer array named numbers with size 5, which means it can hold 5 integer values.
Complete the code to assign the value 10 to the first element of the array numbers.
numbers[[1]] = 10;
Array indices in Java start at 0, so the first element is at index 0.
Fix the error in the code to print the length of the array numbers.
System.out.println(numbers[1]);In Java, arrays have a length property (without parentheses) to get their size.
Fill both blanks to create an array of strings named fruits with 3 elements and assign "Apple" to the first element.
String[] fruits = new String[[1]]; fruits[[2]] = "Apple";
The array fruits is created with size 3, and the first element at index 0 is assigned "Apple".
Fill all three blanks to create an integer array named scores, assign 100 to the last element, and print it.
int[] scores = new int[[1]]; scores[[2]] = 100; System.out.println(scores[3]);
The array scores has size 4, the last element is at index 3, and it is accessed using scores[scores.length - 1] to print the last element.
