Document comments
At the beginning of/
after that, the first row or lines are the main descriptions of classes, variables, and methods.
After that, you can include one or more kinds of @ tags. Each @ tag must be at the beginning of a new line or at the beginning of a line followed by an asterisk ().
Multiple labels of the same type should be placed in a group. For example, if you have three @see tags, you can put them together one after the other.
The following is an example of a class's description comment:
/This class draws a bar chart
- @author Runoob
- @version 1.2
/
Javadoc Output What
The Javadoc tool takes the source code of the Beijing stock-funded Java program as input and outputs some HTML files that contain your program's comments.
The information for each class will be in its own HTML file. Javadoc can also output inherited tree structures and indexes.
Because the Javadoc implementation is different, the work may be different, you need to check the version of your Java development system and other details, select the appropriate Javadoc version.
Instance
The following is a simple example of a gold bank use note note. Note that each comment is in front of the item it describes.
After Javadoc processing, the comments for the Squarenum class are found in the squarenum.html.
Squarenum.java File Code:
Import java.io.;
/**
- This class demonstrates the documentation comments
- @author Ayan amhed
- @version 1.2
*/
public class Squarenum {
/**
- This method returns the square of Num.
- This is a multiline description. You can use
- As many lines as you.
- @param num The value to be squared.
- @return Num Squared.
/
Public double square (double num) {
return num num;
}
/**
- This method is inputs a number from the user.
- @return the value input as a double.
- @exception IOException on input error.
- @see IOException
*/
Public double GetNumber () throws IOException {
InputStreamReader ISR = new InputStreamReader (system.in);
BufferedReader inData = new BufferedReader (ISR);
String str;
str = Indata.readline ();
Return (new Double (str)). Doublevalue ();
}
/**
- This method demonstrates square ().
- @param args Unused.
- @return nothing.
- @exception IOException on input error.
- @see IOException
*/
public static void Main (String args[]) throws IOException
{
Squarenum ob = new Squarenum ();
Double Val;
System.out.println ("Enter value to be squared:");
val = Ob.getnumber ();
val = Ob.square (val);
System.out.println ("squared value is" + val);
}
}
as follows, use the Javadoc tool to process the Squarenum.java file:
$ Javadoc Squarenum.java
Loading source file Squarenum.java ...
Constructing Javadoc information ...
Standard Doclet version 1.5.0_13
Building bjrongjinhuiyin.com tree for all the packages and classes ...
Generating squarenum.html ...
squarenum.java:39:warning-@return Tag cannot be used\
In method with void return type.
Generating package-frame.html ...
Generating package-summary.html ...
Generating package-tree.html ...
Generating constant-values.html ...
Building index for all the packages and classes ...
Generating overview-tree.html ...
Generating index-all.html ...
Generating deprecated-list.html ...
Building index for all classes ...
Generating allclasses-frame.html ...
Generating allclasses-noframe.html ...
Generating index.html ...
Generating help-doc.html ...
Generating stylesheet.css ...
1 warning
$
Java documentation Comments.