如果我没有与我关联的域,我应该如何命名包?
所以大多数 Java 资源在谈到包时都会提到 com.yourcompany.project
设置.但是,我不在公司工作,也没有网站.是否有任何通用的命名约定?一个电子邮件地址,也许?
So most Java resources when speaking of packages mention a com.yourcompany.project
setup. However, I do not work for a company, and don't have a website. Are there any naming conventions that are common? An email address, perhaps?
推荐答案
使用像bernard"这样的顶级域名或其他独特的域名.重要的部分是域是唯一的,这样可以避免冲突,而不是从真正的 Internet 顶级域开始,如 org 或 com.例如
Use a top-level domain like 'bernard' or something else unique. The important part is that the domain is unique so that you avoid clashes, and not that it starts with a real Internet top-level domain like org or com. E.g.
import java.util.*;
import bernard.myProject.*;
import org.apache.commons.lang.*;
相关文章