A method or a data member which is declared as ________ is accessible to all classes in the Java program.

  • default (package-private)
  • private
  • protected
  • public
In Java, when a method or data member is declared as "public," it is accessible to all classes, regardless of their location in the program. This is the highest level of visibility, and it allows unrestricted access from any part of the program.
Add your answer
Loading...

Leave a comment

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