Opening Hours :7AM to 9PM
Package is a container which is collection of classes, interfaces and sub packages, subpackage is collection of classes , interfaces and sub packages. The main advantage with package is common reusability that means the predefined properties of classes and interfaces of package can be used in any java program without rewriting of code. In java language packages are classified into two types.
2.User defined packages.
If any package is designed by the user and if it is used by one or more specific java developers known as user defined package.
While developing real time application it is highly recommended to keep all the programs in a package structure.
In java language user defined packages can be created with the help of package keyword.
Syntax: Package pack1.pack2. ……;
In the above syntax pack1 is the main package,pack2,…..are the sub packages.