フリー問題

Java SE 17 Developer のフリー問題 13 / 20 問目

問題文

A library wants one of its packages to be readable by two companion modules while it stays hidden from everybody else. Which directive expresses that?

選択肢

  1. An opens directive for that package that names the two companion modules, because that form limits ordinary access to the modules that are named
  2. A requires transitive directive in each of the two companion modules, because that form asks for access to a package that is otherwise closed
  3. An export of that package that names the two companion modules after the keyword for the target, so that no other module is able to read the package
  4. An export of that package without any target, together with a requires directive in the library that names the two companion modules as the readers

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

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