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 mentioning 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, ...

Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.