Java / Java 21 Coding Standards Interview Questions
Describe the recommended package naming convention in Java style guides?
Package names are written entirely in lowercase, with no underscores or camelCase, and follow the reversed-domain pattern such as com.company.project.module. Lowercase avoids any collision with class names, which start with an uppercase letter by convention.
Beneath the reversed-domain root, packages are typically organized by feature or layer, for example com.acme.billing.invoice or com.acme.billing.api, rather than by generic buckets like utils or common that tend to accumulate unrelated classes over time.
A package name should never contain Java reserved words, and if it must include a digit or an otherwise invalid identifier segment, an underscore is used only as a last resort, for example com.acme._2024report.
More Related questions...