Content deleted Content added
No edit summary |
|||
Line 50:
Packages are usually defined using a [[hierarchical]] naming [[pattern]], with levels in the hierarchy separated by periods (<code>.</code>) (pronounced "dot"). Although packages lower in the naming hierarchy are often referred to a "subpackages" of the corresponding packages higher in the hierarchy, there is no semantic relationship between packages. The [http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html Java Language Specification] establishes package naming conventions in order to avoid the possibility of two published packages having the same name. The naming conventions describe how to create unique package names, so that packages that are widely distributed will have unique namespaces. This allows packages to be easily and automatically installed and catalogued.
In general, a package name begins with the [[top level ___domain]] name of the organization and then the organization's ___domain and then any subdomains listed in reverse order. The organization can then choose a specific name for their
For example, if an organization in Canada called MySoft creates a package to deal with fractions, naming the package <tt>ca.mysoft.fractions</tt> distinguishes the fractions package from another similar package created by another company. If a US company named MySoft also creates a fractions package, but names it <tt>com.mysoft.fractions</tt>, then the classes in these two packages are defined in a unique and separate namespace.
|