org
和com
包在Java中的含义是什么?
最佳答案
根据Sun , 包应该根据你的域名的倒数来命名,然后是你认为合适的任何东西。大多数公司或组织都有 .com
或 .org
域名,因此大多数软件包以 com.
或 org 开头。
。引用 Sun Code Conventions :
The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, currently com, edu, gov, mil, net, org, or one of the English two-letter codes identifying countries as specified in ISO Standard 3166, 1981.
Subsequent components of the package name vary according to an organization's own internal naming conventions. Such conventions might specify that certain directory name components be division, department, project, machine, or login names.
他们提供的示例清楚地表明您应该使用公司的 DNS 名称:
com.sun.eng
com.apple.quicktime.v2
edu.cmu.cs.bovik.cheese
您还将看到 edu.
和 net.
打包出 in the wild也一样,尽管它们不太常见。
关于Java 包 com 和 org,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2125293/