Home >Java >javaTutorial >What to write in java package name
Java package names are composed of lowercase words, and the first letter of the class name is capitalized; the path of the package conforms to the definition of the system module being developed, such as production to production, materials to materials, and basic classes to basic classes. So that you can understand which module it is by looking at the package name, and then go directly to the corresponding package to find the corresponding implementation.
Due to the object-oriented nature of Java, every Java developer can write his own Java Package. In order to ensure the uniqueness of each Java Package naming, in the latest In the Java programming specification, developers are required to add a unique prefix before the package name they define. Since domain names on the Internet are not repeated, most developers use their company's domain name on the Internet as the unique prefix of their own program packages. For example: com.sun.swt.……. (Recommended learning: Java Video Tutorial)
Thus, we know that the general company name is "com. Company name. Project name. Module name....".
Then, how should we name our personal projects?
After my search for "individual" words, there are "individual, personal, private, one-man". I further analyzed the meaning of the above four words and used each to ensure uniqueness. The first 4 letters of the word are used as prefixes to distinguish them from "com". As follows:
indi:
Individual projects refer to projects initiated by individuals but not completed by themselves alone. They can be public or private projects. The copyright mainly belongs to the initiator.
The package name is "indi. Initiator name. Project name. Module name...".
pers:
Personal projects refer to projects initiated by individuals, completed alone, and shareable. The copyright mainly belongs to individuals.
The package name is "pers.personal name.project name.module name...".
priv:
Private projects refer to projects initiated by individuals, completed alone, and non-public for private use. The copyright belongs to the individual.
The package name is "priv.Personal name.Project name.Module name...".
onem:
is the same as "indi", it is recommended to use "indi".
team:
Team projects refer to projects initiated and developed by the team, and the copyright belongs to the team.
The package name is "team.Team name.Project name.Module name...".
com:
Company project, the copyright is owned by the company that initiated the project.
The package name is "com.Company name.Project name.Module name...".
For more Java-related technical articles, please visit the Java Development Tutorial column to learn!
The above is the detailed content of What to write in java package name. For more information, please follow other related articles on the PHP Chinese website!