A java package is a group of similar types of classes, interfaces and sub-packages.
Package in java can be categorized in two form, built-in package and user-defined package.
To Compile: javac -d . Simple.java |
To Run: java mypack.Simple |
To run this program from e:\source directory, you need to set classpath of the directory where the class file resides.
There are three ways to access the package from outside the package.
- import package.*;
- import package.classname;
- fully qualified name.
**If you import a package, subpackages will not be imported.