A type-import-on-demand declaration allows all public
types declared in the
package named by a fully qualified name to be imported as needed.
TypeImportOnDemandDeclaration:
import
PackageName. * ;
It is a compile-time error for a type-import-on-demand declaration to name a
package that is not accessible (§6.6), as determined by the host system (§7.2).
Two or more type-import-on-demand declarations in the same compilation unit
may name the same package; the effect is as if there were exactly one such declaration. It is not a compile-time error to name the current package or java.lang
in
a type-import-on-demand declaration, even though they are already imported; the
duplicate type-import-on-demand declaration is ignored.
import java.util.*;
causes the simple names of all public
types declared in the package java.util
to be available within the class and interface declarations of the compilation unit.
Thus, the simple name Vector
refers to the type Vector
in the package
java.util
in all places where it is not hidden (§6.3) by a single-type-import declaration of a type whose simple name is Vector
; by a type named Vector
and
declared in the package to which the compilation unit belongs; or by a declaration
of a field, parameter, or local variable named Vector
. (It would be unusual for any
of these conditions to occur.)