Java package naming and non .com domains

孤者浪人 提交于 2019-12-11 07:07:37

问题


From what I understand Java packages often use a company's website as a package namespace.

For example if stackoverflow had a Java widget library it might be called com.stackoverflow.widget.

But what happens if you use an obscure TLD. Is info.example.widget acceptable?


回答1:


Sure, no problem. Whatever your company's domain name and whatever its TLD is, reverse the order of its components for your Java packages.




回答2:


The intent of using a domain name is that it helps ensure uniqueness using something that pretty much any organization will already have. That means that no one really needs to be 'responsible' for doling out uniques IDs for package names (or that something ugly like the GUIDs used by COM don't need to be used).

So even if your domain name is obscure, by all means use it - it's still unique.



来源:https://stackoverflow.com/questions/3868619/java-package-naming-and-non-com-domains

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