Top

Discussion

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?

  • A.final
  • B.static
  • C.private
  • D.protected
  • E.
    volatile

Answer: C

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 finalstatic, and volatile are modifiers but not access modifiers.

No comment is present. Be the first to comment.
Loading…

Post your comment