2.19 Visibility Modifiers2.18 Frameworks2 Java with Caffeine2.19.1 Class Visibility

2.19 Visibility Modifiers

Usually not all the fields and methods of a class are intended for general use, i.e., some of them may be just intended for internal purposes. In Java, we have several  visibility modifiers that may be used to explicitly restrict the access to classes, fields, and methods.

Up to now we have mainly used "default visibility" (no visibility modifier was given). Classes, fields, and methods with default visibility are only visible to classes within the current package but not to classes outside the package.


© Wolfgang Schreiner; February 3, 2005

2.19 Visibility Modifiers2.18 Frameworks2 Java with Caffeine2.19.1 Class Visibility