The import statement make available one or all the classes in a package to the current source file. Keywords are basically reserved words which have specific meaning relevant to a compiler. Once a package in a java source file is imported then that class (source file) can use the classes available in the package without specifying the package name to which the class belongs.
Syntax: Here is the syntax to import a package in a class.
Due to the rigid naming convention used by java programming language, java compile easily finds the corresponding source file simply by using fully qualified name of the class along with the package name. Here is the syntax for the style of import a package and the class of that package:
|java.util.ArrayList a = new java.util.ArrayList ( 25 );|
Note: Here are some points that must consider while importing a package.
Posted on: November 11, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles