2

For example: Which of the following package names is correct?

com.google.payrolldivision;

or

com.google.payrollDivision;

Please just answer the question without beating around the bush?

The Guest
  • 698
  • 11
  • 27
  • 4
    http://stackoverflow.com/questions/3179216/what-is-the-convention-for-word-separator-in-java-package-names – Jean Logeart Apr 20 '16 at 21:47
  • Yes. Why wouldn't you be able to? – Elliott Frisch Apr 20 '16 at 21:47
  • 1
    Why don't you just try it for yourself and see? – OldProgrammer Apr 20 '16 at 21:48
  • 1
    According to the official docs, looks like it is simply a matter of choice/style to use camel case or not; apparently there's nothing actually prohibitive about it. The specific reason cited by the docs for lower case convention : *"Package names are written in all lower case to avoid conflict with the names of classes or interfaces."* .. that's it. I just tested for the following, and it built & ran fine package `com.abc.activity.navDrawer;` https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html. – Gene Bo Oct 15 '18 at 20:55

2 Answers2

9

Please just answer the question

OK, then taking your question as a "a xor b", the answer is

com.google.payrolldivision;

as per https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html.

However, your title and post ask two very different questions, so it's hard to "just answer the question".

Ingo Bürk
  • 19,263
  • 6
  • 66
  • 100
3

According to the Oracle webpage, you should write your package name in lowercase.

Package names are written in all lower case to avoid conflict with the names of classes or interfaces.

Alberto Alegria
  • 1,023
  • 10
  • 26