Categories
Java

Java Cookbook

Java Language Features

Packages

Packages work like Namespaces do in C++.

Packages provide an elegant way to name groups of related classes, and the classes within a package have package-private access by default (i.e., visibility scoped to the package level).

Default Visibility

Classes

Default: package-private.

To get a class to appear in the docs (using JavaDoc), you must make it public (explicitly).

Class Members

Default: package-private.

public: The member can be accessed

private: The member can be accessed from within its own class only.

protected: The member can be accessed from within a subclass in another package.

Leave a Reply