フリー問題

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

問題文

Code in module alpha uses a public class from the package beta.api, and that package lives in module beta. What has to appear in the two module declarations before the code in alpha will compile?

選択肢

  1. The declaration of alpha has to require beta and nothing more is needed, since every one of the public classes of a required module is reachable from there
  2. Both declarations have to name each other with requires, because reading a package is a mutual relationship
  3. The declaration of alpha has to require beta and the declaration of beta has to export the package beta.api, because both of the directions are stated on purpose
  4. The declaration of beta has to export the package and no entry in alpha is needed, since an export names the modules that may read it

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

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