Believe that as a Java program ape, almost everyone has used javac,java such a command bar. Think of our usual Java Help document (API), it feels good to use, in fact, it is using the Java command Javadoc made. Here's a quick introduction to how this command works:
First of all, in Java with three kinds of annotation, in order to use Javadoc to generate documents and add the comment information into the document, it is necessary to use this way:
1 /** 2 * 3 */
The second is where the annotation information should be placed. 1. The comments on the class are placed before the class declaration; 2. Comment on the method before the method declaration; Here is a simple example:
1 PackageCom.review.chapter3;2 3 /**4 * classname:usejavadoc<br>5 * Description: Description of Java Chinese document through Usejavadoc class notes <br>6 * Company:zhouxy7 * @authorZhouxy8 * @version201408299 *Ten */ One Public classUsejavadoc { A PublicString name; - - /** the * This is the constructor of the Usejavadoc class - * @paramName Parameter - */ - PublicUsejavadoc (String name) { + This. Name =name; - } + A at /** - * This is a description of the GetAll method - * @paramNumber of Numbers - * @returnQuantity - */ - Public intGetAll (intNumber ) { in - returnNumber ; to } +}
In the above code, some comments are followed by <br> tags, and some do not, because the @ symbol comes with a newline character, so use @ does not have to add <br> tags.
The following is generated using the Javadoc command. First use the shortcut key win+r, type cmd in the dialog box, switch to the directory saved by the file, and then three different ways (assuming you want to save the generated HTML document in the Docdirectory directory):
1. If you want to generate a package: javadoc-d docdirectory-version-author nameofpackage
2. If you want to generate multiple packages: javadoc-d docdirectory-version-author nameOfPackage1 nameOfPackage2 .....
3. If the file is in the default package: javadoc-d docdirectory-version-author *.java
If you omit-D docdirectory then the resulting HTML document will be saved in the current directory, which can be confusing and not advocated.
-version-author indicates that version information and author information are required to be included in the documentation. Nameofpackage represents the package name in which the Java class resides.
Working with document annotations (Javadoc)