Java OCA OCP Practice Question 1219

Question

Fill in the blanks:

The ___ access modifier allows access to everything the ___ access modifier does and more.

  • A. public, private
  • B. private, package-private
  • C. package-private, protected
  • D. private, public


A.

Note

The public modifier allows access to members in the same class, package, subclass, or even classes in other packages, while the private modifier allows access only to members in the same class.

The public access modifier allows access to everything the private access modifier does, and more, making Option A the correct answer.

Options B, C, and D are incorrect because the first term is a more restrictive access modifier than the second term.




PreviousNext

Related