MCQs City stays free thanks to ads. Please turn off your ad blocker for this site so content and features keep working.
Computer Programming MCQs
Java concepts and its programming
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 ?
AA. Declare the method with the keyword public.
BB. Declare the method with the keyword private.
CC. Do not declare the method with any accessibility modifiers.
DD. Declare the method with the keyword public and private.
Correct Answer:
C. C. Do not declare the method with any accessibility modifiers.