How should one separate words in package names? Which of the following are correct?
com.stackoverflow.my_package
(underscore)com.stackoverflow.my-package
(hyphens)com.stackoverflow.MyPackage
(CamelCase)What is the general standard?
All three are not the conventions.
Use com.stackoverflow.mypackage
.
The package names do not follow camel casing or underscores or hyphens package naming convention.
Also, Google Java Style Guide specifies exactly the same (i.e. com.stackoverflow.mypackage
) convention:
5.2.1 Package names
Package names are all lowercase, with consecutive words simply concatenated together (no underscores). For example,
com.example.deepspace
, notcom.example.deepSpace
orcom.example.deep_space
.— Google Java Style Guide: 5.2 Rules by identifier type: 5.2.1 Package names.