Home » Java Programming » Declarations and Access Control

Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?

Correct Answer: private

Explanation:

The private access modifier limits access to members of the same class.


Option A, B, D, and E are wrong because protected are the wrong access modifiers, and final, static, and volatile are modifiers but not access modifiers.


← Previous Question Next Question→

More Questions from Declarations and Access Control

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion