Q. A 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?

  • (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) Declare the method with the keyword protected. D. Do not declare the method with any accessibility modifiers.
πŸ’¬ Discuss
βœ… Correct Answer: (D) Declare the method with the keyword protected. D. Do not declare the method with any accessibility modifiers.

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
125
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ritu Singhal
Publisher
πŸ“ˆ
80%
Success Rate