Is this a valid java package name? [duplicate]

别来无恙 提交于 2019-12-24 02:18:49

问题


Possible Duplicate:
What package naming convention do you use for personal/hobby projects in Java?

I made a google sites site name sites.google.com/sites/abc.(abc is not real name)

Would mcl.abc.sites.com.google.sites be valid for a package name.

EDIT: Whoops com.google.sites.abc.mcl


回答1:


Valid? Yes. Conventional? Probably not.

Java conventions typically recommend package names to be a website address (like your company's) in reverse, e.g. com.google.foo.

More on naming conventions here.




回答2:


you can use any name, but if its valid its about the criteria that you use, i recommend the following criteria:

1) avoid to use country.company.util (i work in a project that the company change 3 times of name, so you can see in the same project names like: com.companyname1.util, cl.companyname2.util, com.companyname3.util) 2) you can use naming like: dev.utils or apiname.commons.utils or any other criteria

Well, i hope this clarify your doubts.




回答3:


Standard coding convention for packages in Java reverses the domain name.

Given your example,

sites.google.com/sites/abc

com.google.sites.abc.mcl


来源:https://stackoverflow.com/questions/12168968/is-this-a-valid-java-package-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!