Introduction
Here I am explaining Package Control keywords in Java.
In Package control there are only two keywords:
- Import
- Package
Here is the explanation.
Import Keyword
The import keyword is used to make classes and interfaces available and accessible to the current source code, without specifying fully qualified package names. For example,
- import java.awt.*;
- import java.util.List;
- import java.io.File;
Likewise, the second and third import statements make the interface list and the class file available to the current source code. It uses exact names instead of a wildcard.
The import statements must be placed on top of the source file, only after the package statement.
Package Keyword
The package keyword is used to specify a directory structure to which the current source file must belong. For example,
- package com.mycompany.code;
- public class MyClass {
- }
Here are some rules regarding the package statement:
- A source file can be put under a package or not.
- The package statement (if specified) must be the first line in the source file.
- Package name must follow the pattern: level1.leve2.level3....leveln
Summary
In this article, we studied about package keyword in java

SubashPosted Aug 1, 2016, 5:22 AM
Nice Share
Asfend YarPosted Feb 29, 2016, 2:06 PM
thanks
Santhakumar MunuswamyPosted Dec 28, 2015, 1:30 PM
thanks for sharing
Gopi ChandPosted Nov 18, 2015, 2:04 PM
Good one