What is package in Java?
Java package is a group of similar types of classes, interfaces and sub-packages. Conceptually you can think of packages as being similar to different folders on your computer. Packages are used in Java in order to prevent naming conflicts , to control access, to make searching/locating and usage of classes, interfaces, enumerations, annotations etc. Although interfaces and classes with the same name cannot appear in the same package, they can appear in different packages. This is possible by assigning a separate namespace to each package.
How to compile java package
The -d switch specifies the destination where to put the generated class file. If you want to keep the package within the same directory, you can use . (dot).