O'Reilly logo

Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition by Rolf W. Rasmussen, Khalid A. Mughal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.7. Accessibility Modifiers for Top-level Classes and Interfaces

Top-level classes and interfaces within a package can be declared as public. This means that they are accessible from everywhere, both inside and outside of their package. If the accessibility modifier is omitted, then they are only accessible in the package and not in any other packages or subpackages. This is called package or default accessibility.

Accessibility modifiers for nested classes and interfaces are discussed in Section 7.1 on page 284.

Example 4.7. Accessibility Modifiers for Classes and Interfaces
 // File: Clown.java package wizard.pandorasBox; // (1) Package declaration import wizard.pandorasBox.artifacts.Ailment; // (2) Importing class public class Clown implements ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required