I have seen this so often and it confuses the hell out of me.

I always title the packages directly after what they are. For example the path to my Main class is never "me.myproject.main.Main.class" but only "main.Main.class" and so far I have never had problems with it.

However I have seen everyone doing it otherwise so often, that I wonder: Is that really just a meaningless convention (like for (int i = 0...)) or does it actually have practical use adding all that, that just isn't apparent to me?

有帮助吗?

解决方案

Packages are usually named using the reverse-domain name of an organization, ie. com.example.projectname.Main.class. If everyone were to name their packages main.Main.class, what would happen if you were using my code in your project? You would end up with conflicting main.Main classes.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top