フリー問題

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

問題文

Two loops are nested. When a matching element is found in the inner loop, the program must stop searching entirely and continue with the code that follows the outer loop. Which mechanism does that with a single statement?

選択肢

  1. A break statement with no label at all, which ends both loops and then resumes where an outer loop has just ended.
  2. A break statement that names a label placed on the outer loop, so control resumes after that loop.
  3. A continue statement that names a label placed on the outer loop, which skips the remaining iterations of both loops and moves past them.
  4. A return statement, which is the only way to leave more than one level of loop and is therefore required whenever loops are nested inside one another.

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

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