What is a Java Package
A package is a collection of classes and the related functions within the classes.
Packages are container for classes that are used to keep the class name space compartmentalized. For example, you can create a class named “Abc” in your package “mypackage” without being concerned to it being colliding with other class also named as “Abc”. And then you can write your own methods in it for the later use by you or anyone that uses that package.
Packages are stored in a hierarchical way. That means you can create a package inside a package. This is like a box contained inside a box.
Now how to create a package? Well this is simple, you just need to use the keyword ‘package’ followed by the name of the package.
This is the general form of the package statement: