What does the following statement do? double[] array1 = new double[10]; A. Declares array1 to be a reference to an array of double values B. Creates an instance of an array of 10 double values C. Will allow valid subscripts in the range of 0 - 9 D. All of the above
Computers and Technology · High School · Tue Nov 03 2020
Answered on
All of the above.
Explanation of each point:
A. Declares array1 to be a reference to an array of double values: This is true because in Java, an array is an object and 'array1' is a reference variable that points to an array object which will contain 'double' values.
B. Creates an instance of an array of 10 double values: This is also true because 'new double[10]' is the actual creation of the array object in memory with space for 10 double values.
C. Will allow valid subscripts in the range of 0 - 9: This is accurate because array indices in Java are zero-based, so an array with 10 elements has valid indices from 0 through 9.