フリー問題

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

問題文

A try block completes without throwing anything, and the method has a matching catch block and a finally block. Which sequence describes what runs?

選択肢

  1. The try block runs, the finally block runs, and then the catch block runs so that cleanup happens before any handling code observes the state of the resources.
  2. The try block runs to its end, the catch block is skipped, and then the finally block runs before control leaves the statement.
  3. The try block runs, the catch block runs with a null exception reference, and the finally block runs last.
  4. The try block runs and the finally block is skipped, and finally exists only to clean up after an exception has actually been thrown somewhere in the try.

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

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