Top community members

Have you ever heard about encyclopedia for code?

What about: Wiki for Code project?

* because I've tried to share code and my solutions on different services and it was removed or I was unwelcomed
   - maybe it wasn't good place, but this one is.

if you think you have solution that can help someone, you are welcome to share this solution - Click here

Java - package naming convention

4 points
Asked by:
Bartek πŸ™‚

Is there a correct way to name packages in java?

Can I use underscores or do I need to use capital letters like with class names?

My package names combinations:


Which one is correct? Or there is more then 1 correct way to name packages in java?

1 answers
4 points
Answered by:
Bartek πŸ™‚

From Oracle code convention:

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.



9 - Naming Conventions

From google java style guide:

5.2.1 Package names
Package names are all lowercase, with consecutive words simply concatenated together (no underscores).

For example:

// correct:

// incorrect:

style guide - 5.2.1-package-names

0 comments Add comment

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey πŸ‘‹
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more