Which of the following access modifiers allows a member to be accessed from anywhere?

  • default (no modifier)
  • private
  • protected
  • public
In Java, the public access modifier allows a member to be accessed from anywhere, including outside the class, package, and even from different packages. It provides the highest level of accessibility. The other options restrict access to varying degrees.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *