Packages and Permissions
- A package is a collection of classes (types) and,
java is a package that contains the subpackage
java.lang contains about 50 classes and several subpackages.
- A package hierarchy corresponds to a file system hierarchy on
disk. In Windows, substitute '\' for '.' in the package name.
- You can name the package that the classes in a compilation unit
belong to using the
package statement at the beginning of
import statements to name classes whose members
you want to reference without having to specify the fully-qualified
- All the compilation units in the same directory are part of the
same unnamed package unless you use a
in some (or all) of them.
- A public class or member can be referenced outside its
- A protected class or member can be referenced only inside
its own class or from within a subclass.
- A private class or member can be referenced only from
inside the class that it is defined in.