Java Reference
In-Depth Information
Programming and
Documentation Conventions
This chapter explains a number of important and useful Java programming and
documentation conventions. It covers:
• General naming and capitalization conventions
• Portability tips and conventions
javadoc documentation comment syntax and conventions
Naming and Capitalization Conventions
The following widely adopted naming conventions apply to packages, reference
types, methods, fields, and constants in Java. Because these conventions are almost
universally followed and because they affect the public API of the classes you define,
they should be followed carefully:
It is customary to try to ensure that your publicly visible package names are
unique. One very common way of doing this is by prefixing them with the
inverted name of an Internet domain that you own (e.g., com.oreilly.javanut
shell ). All package names should be lowercase.
Packages of code used internally by applications distributed in self-contained
JAR files are not publicly visible and need not follow this convention. It is com‐
mon in this case to use the application name as the package name or as a pack‐
age prefix.
Search WWH ::

Custom Search