What is the default package in which my classes are put if I don’t specify it?

A class that is not in a named package is in an unnamed package. Thus the full class name is Main.

Such classes cannot be used from a named package, except via reflection.

The JLS says that:

Unnamed packages are provided by the Java SE platform principally for convenience when developing small or temporary applications or when just beginning development.

Leave a Comment