Java Reference
In-Depth Information
allows for various pieces of documentation to be hyperlinked together. Reconsider the BMI example
as follows:
/** This class allows you to calculate the <b> <u> BMI </u></b> using the inputs:
* <ul>
* <li> weight; </li>
* <li> height. </li>
* </ul>
* See <a href=" http://en.wikipedia.org/wiki/Body_mass_index" >Wikipedia</a> for
* more information.
* @author Bart Baesens
*/
public class BMICalculator {
// declare variables
static double weight;
static double height;
static double BMI;
// This is our main method.
public static void main(String[] args){
weight=60;
height=1.70;
/* Here, we call the method calculateBMI which will
* calculate the BMI
*/
calculateBMI();
// print BMI to screen
System.out.println("Your BMI is " + BMI +".");
}
// method calculating BMI
public static void calculateBMI(){
BMI = weight/(height*height);
}
}
This is essentially the same code as before, except that a header has been added, as follows:
/** This class allows you to calculate the <b> <u> BMI </u></b> using the inputs:
* <ul>
* <li> weight; </li>
* <li> height. </li>
* </ul>
* See <a href=" http://en.wikipedia.org/wiki/Body_mass_index" >Wikipedia</a> for
* more information.
* @author Bart Baesens
*/
This header adds Javadoc HTML documentation to the class definition. Javadoc comments are
enclosed between /** ... and */ . Remember the HTML tags <b>... </b>, and <ul>... </ul>
Search WWH ::




Custom Search