Packages in Java enable grouping of related classes and avoid namespace collisions. Package names use dot notation to represent directory structure. The fully qualified name of a class includes its package. To create a package, the directory structure must match the package name hierarchy. A class belongs to a package by including the package statement at the top of its file and storing the class in the corresponding directory. Packages must be imported or the CLASSPATH set to locate non-default packages.