フリー問題

Java SE 21 Developer Professional のフリー問題 14 / 20 問目

問題文

An array of five elements is created with new String[5] and nothing else is done to it. What is true about that array?

選択肢

  1. Every element holds null and the length field reports five, because a reference array is filled with the default value of its type.
  2. 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.
  3. 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.
  4. Every element holds an empty string, and a size method reports how many slots exist, which an array inherits as any object would do.

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。