7.4
Package Declarations
PACKAGES
CompilationUnit:
PackageDeclaration
opt
ImportDeclarations
opt
TypeDeclarations
opt
ImportDeclarations:
ImportDeclaration
ImportDeclarations ImportDeclaration
TypeDeclarations:
TypeDeclaration
TypeDeclarations TypeDeclaration
Types declared in different compilation units can depend on each other, circularly.
A Java compiler must arrange to compile all such types at the same time.
A
compilation unit
consists of three parts, each of which is optional:
A
package
declaration ( 7.4), giving the fully qualified name ( 6.7) of the
package to which the compilation unit belongs
import
declarations ( 7.5) that allow types from other packages to be
referred to using their simple names
Type declarations ( 7.6) of class and interface types
Every compilation unit automatically and implicitly imports every
public
type name declared in the predefined package
java.lang
, so that the names of all
those types are available as simple names, as described in 7.5.3.
7.4 Package Declarations
A package declaration appears within a compilation unit to indicate the package
to which the compilation unit belongs. A compilation unit that has no package
declaration is part of an unnamed package.
7.4.1 Named Packages
A
package declaration
in a compilation unit specifies the name ( 6.2) of the pack
age to which the compilation unit belongs.
PackageDeclaration:
package
PackageName
;
The package name mentioned in a package declaration must be the fully qualified
name ( 6.7) of the package.
118
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved