Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
Visibility, in the context of Java programming, refers to the accessibility or scope of classes, methods, and variables from different parts of a program. It determines whether they can be accessed or used by other classes or code.
Related terms
Public: Public is an access modifier in Java that allows unrestricted visibility for classes, methods, and variables. They can be accessed from anywhere within the program.
Private is an access modifier in Java that restricts the visibility of classes, methods, and variables to only within their own class. They cannot be accessed from outside the class.
Protected: Protected is an access modifier in Java that provides visibility within the same package as well as subclasses outside the package. It allows limited accessibility compared to public but more than private.