問題文
An array of five elements is created with new String[5] and nothing else is done to it. What is true about that array?
選択肢
- Every element holds null and the length field reports five, because a reference array is filled with the default value of its type.
- The array has no elements yet and grows automatically as values are assigned to positions beyond the current end of the array, so the length follows the highest index that has been used.
- The array holds five elements whose values are undefined, so reading one before assigning to it produces a compile time error about a variable not being initialized.
- Every element holds an empty string, and a size method reports how many slots exist, which an array inherits as any object would do.