Single Choice Not Set

QA method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?

ID: #2109 Declaration and Access Control in Java 11,530 views
Question Info
#2109Q ID
Not SetDifficulty
Declaration and Access Control in JavaTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Declare the method with the keyword public.
  • B Declare the method with the keyword private.
  • C Declare the method with the keyword protected.
  • D Do not declare the method with any accessibility modifiers.
Correct Answer

Explanation

Do not declare the method with any accessibility modifiers.

Share This Question

Challenge a friend or share with your study group.

Related MCQ Questions