我想创建一个名为 form validator
的包。
是不是写的比较好
form_validator
,formValidator
或formvalidator
?
我想提一下,我想避免 form.validator
。并且 form-validator
是禁止的。
最佳答案
来自documentation关于包命名约定:
Package names are written in all lower case to avoid conflict with the names of classes or interfaces
所以这会给你留下以下两种可能性:
form_validator
formvalidator
其实文档也说的很清楚,下划线在包名中的作用很特殊:
if the package name begins with a digit or other character that is illegal to use as the beginning of a Java name, or if the package name contains a reserved Java keyword, such as "int" ... the suggested convention is to add an underscore.
因此,仅在特殊情况下才建议使用下划线,您的命名问题似乎不会落入其中。所以我会推荐 formvalidator
作为包名。
关于java - 组合包名称的命名约定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49890803/