フリー問題

Java SE 11 Developer のフリー問題 7 / 20 問目

問題文

A type in a shared library carries no access modifier of its own and declares no constructor. Which visibility does the constructor supplied for that type receive, and why?

選択肢

  1. It receives package access, because the supplied constructor takes the access modifier of the class and settles on package access where the class leaves that modifier out
  2. It receives private access, because the supplied constructor takes the narrowest access available and treats the class as shut against creation from outside
  3. It receives public access, because the supplied constructor takes the widest access the enclosing package grants and leaves the modifier of the class aside as a hint
  4. It receives protected access, because the supplied constructor takes the access that a subclass in a further package needs and treats the modifier of the class as a hint

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

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