Java Reference
In-Depth Information
7.4.3. Observability of a Package
A package is observable if and only if either:
• A compilation unit containing a declaration of the package is observable (§ 7.3 ).
• A subpackage of the package is observable.
The packages java , java.lang , and java.io are always observable.
One can conclude this from the rule above and from the rules of observable compila-
tion units, as follows. The predefined package java.lang declares the class Object , so the
compilation unit for Object is always observable (§ 7.3 ) . Hence, the java.lang package is
observable (§ 7.4.3 ), and the java package also. Furthermore, since Object is observable,
the array type Object[] implicitly exists. Its superinterface java.io.Serializable 10.1 ) also
exists, hence the java.io package is observable.
7.5. Import Declarations
An import declaration allows a named type or a static member to be referred to by a simple
name (§ 6.2 ) that consists of a single identifier.
Without the use of an appropriate import declaration, the only way to refer to a type declared
in another package, or a static member of another type, is to use a fully qualified name
6.7 ) .
ImportDeclaration:
SingleTypeImportDeclaration
TypeImportOnDemandDeclaration
SingleStaticImportDeclaration
StaticImportOnDemandDeclaration
• A single-type-import declaration (§ 7.5.1 ) imports a single named type, by men-
tioning its canonical name (§ 6.7 ) .
• A type-import-on-demand declaration (§ 7.5.2 ) imports all the accessible types
6.6 ) of a named type or named package as needed, by mentioning the canonical
name of a type or package.
• A single-static-import declaration (§ 7.5.3 ) imports all accessible static members
with a given name from a type, by giving its canonical name.
• A static-import-on-demand declaration (§ 7.5.4 ) imports all accessible static mem-
bers of a named type as needed, by mentioning the canonical name of a type.
Search WWH ::




Custom Search