Java Packages
About java packages
The name package implies a collection of types, somewhat like a library. In use a package is also a little like a directory. If you place a package statement in a file it will only be visible to other classes in the same package. You can place a comment before the package statement but nothing else.
If a source file has a package statement it must become before any other statement apart from comments .
Remember that if you do not place a package statement in a source file it will be considered to have a default package which corresponds to the current directory.
syntax:
package packagename;
package packagename.subpackagename;
Naming a Package
Package names are written in all lower case to avoid conflict with the names of classes or interfaces.
Companies use their reversed Internet domain name to begin their package names—for example, com.example.mypackage for a package named mypackage created by a programmer at example.com.
Name collisions that occur within a single company need to be handled by convention within that company, perhaps by including the region or the project name after the company name (for example, com.example.region.mypackage).
Packages in the Java language itself begin with java. or javax.