int[] data = new int[10]; A good answer might be:
|
Bounds CheckingRecall that: Indexes must be an integer type (since it makes no sense to speak of slot number 1.59, say.) It is OK to have spaces around the index of an array, for exampleThe length of an array is how many slots it has. An array of length N has slots indexed 0..(N-1) data[1] and data[ 1 ] are exactly the same
as far as the compiler is concerned.
Say that an array were declared: Then it is not legal to refer to a slot that does not exist:int[] data = new int[10];
|
QUESTION 6:Here is a declaration of another array: Which of the following are legal?int[] scores = new double[25];
|