Java Reference
In-Depth Information
represent text in bold face and underlined, respectively.
The HTML tag <ul>... </ul> defines an unordered
list with the items specified as <li> ... </li> . You
can add a link to the Wikipedia page with BMI infor-
mation using the HTML tag <a href= “. . .” >... </a> .
You can then use the @author tag to credit the pro-
grammer. Part of the Javadoc generated from this pro-
gram is shown in Figure 2-10.
Note that at the top of the page, you will find the
information included in the program. Next to the
information we added, Javadoc will also generate
some documentation by default, like the fields (vari-
ables) and methods of the class defined. As you will
see later, some integrated development environments
(IDEs) such as Eclipse generate Javadoc HTML doc-
umentation code by default.
It is highly recommended that you use a consistent
documentation style. Consider providing comments
at the top of the class, explaining what the class does
and naming the author, and also adding comments to
each variable and method definition to clarify their
meaning. This is especially important with large-scale projects, where many Java classes are simul-
taneously being programmed by multiple developers.
figure 2-10  
naming conventions
Various Java communities have introduced naming conventions for identifiers. These are not strictly
enforced, so your code will compile successfully even if you don't comply. However, you will improve
the readability and future maintenance of your Java programs if you follow these conventions. A very
popular naming convention originally suggested by Sun Microsystems is explained in Table 2-5.
table 2-5: Java Naming Convention
identifier
convention
good ex amples
bad ex amples
BMICalculator
Student
MyProgram
bmiCalculator
STUDENT
myProgram
Class
UpperCamelCase: The first letter of each word is
capitalized.
Variable
lowerCamelCase: The first letter is lowercase
and the first letters of all following words are
capitalized.
myHeight;
myWeight;
height;
weight;
MyHeight;
myheight;
Height;
WEIGHT;
Method
lowerCamelCase: The first letter is lowercase and
the first letters of all following words are capitalized.
main
calculateMyBMI
Main
CalculateBMI
 
Search WWH ::




Custom Search