Import Declarations
An import declaration allows a static member or a named type to be referred to by
a simple name 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
ImportDeclaration:
SingleTypeImportDeclaration
TypeImportOnDemandDeclaration
SingleStaticImportDeclaration
StaticImportOnDemandDeclaration
1)A single-type-import declaration imports a single named type, by mentioning
its canonical name .
2)A type-import-on-demand declaration imports all the accessible
types of a named type or package as needed. It is a compile time error to
import a type from the unnamed package.
3)A single static import declaration imports all accessible static members
with a given name from a type, by giving its canonical name.
An import declaration allows a static member or a named type to be referred to by
a simple name 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
ImportDeclaration:
SingleTypeImportDeclaration
TypeImportOnDemandDeclaration
SingleStaticImportDeclaration
StaticImportOnDemandDeclaration
1)A single-type-import declaration imports a single named type, by mentioning
its canonical name .
2)A type-import-on-demand declaration imports all the accessible
types of a named type or package as needed. It is a compile time error to
import a type from the unnamed package.
3)A single static import declaration imports all accessible static members
with a given name from a type, by giving its canonical name.
0 comments:
Post a Comment