Packages
Estimated time to read: 1 minute
Before writing code, it is useful to know how store source code files in directories.
Organisation¶
Given that a class name matches the file name, what if many different classes existed with exactly the same name?
Since Java is platform agnostic, it needs a platform agnostic way to manage directories.
Java Package Names¶
Java identifies classes by their fully-qualified name.. Package names start with the domain name of the company or user, reversed eg io.entityfour.
Classes are then appended to the FQN eg io.entityfour.myProgram.myClass
There is an exception to the rule, most Java packages start with java.xxx
instead