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?
ADo not declare the method with any accessibility modifiers.
BDeclare the method with the keyword private.
CDeclare the method with the keyword public and private.
DDeclare the method with the keyword public.
Correct answer
A. Do not declare the method with any accessibility modifiers.
Explanation
The correct answer is Do not declare the method with any accessibility modifiers..