Javadoc's writing

xiaoxiao2021-04-07  259

Original from: http://blog.9cbs.net/mingjava/archive/2004/07/25/51091.aspx                                                                                                             Little will be written, but when you really develop projects in the company. There is usually a strict documentation requirement, I talk about it is not a design or test document, but javadoc. I have always thought that Javadoc seems to be convenient than MSDN, and it is equally uncomfortable. Javadoc is a very important tool in J2SDK. If you write a note in Java's source code, then it can generate the corresponding document. The developer will look very convenient. Many IDEs can generate Javadoc directly, here you introduce how to write Javadoc and how to generate Javadoc under Eclipse. Javadoc usually extracts information from package, public or protected fields, disclosed or protected methods. Each annotation should be started with * / end in / **. E.g.  / **  *  * @param id the coreID of the person * @param userName the name of the person * you should use the constructor to create a person object * / Public SecondClass (int ID, string username) { t = id; this.username = username;                                                                                       And there is a mark of HTML, if it is not marked above, then You Should USR The ... will be tight with @Param Username in Javadoc .... This is not what we hope. General notes can be divided into class annotations, method comments, field annotations, and more. The following is a simple introduction to a class comment. Class Note should be in front of the type declaration in the back of the IMPORT statement, such as Package com.north.java;            @ @Sserface is to define a method print ()  @See com.north.ming.mainclass # main (String [])                       @ @Return Nothing will be return  *                                      @ r  p p p @ @  @ @  Print (String name);} @Author and @see are commonly used annotations first representatives, the second representation of the reference. 2. Method Note   Method Note To follow the way, you can use tags such as @param @return @Throws.

For example, / ** * @ @ pa   @ r @ @ rs i  @ @throws ooException When Reading the file, if Something Wrong Happened  * Then THETHOD Will throws a ioException (INT I) throws ooException {      注 注 注  注 注 段 注 段 段 段 注 注 注 注 注;;;; Static Germ, for example / ** *   public static int hello = 1;                                Generate a document with Javadoc, select Generate Javadoc from menu Project, there will be a wizard, you will follow his prompt to set the requirements step by step, it is best to ask you if you say javadoc.xml, if you choose to generate, he You will generate a javadoc.xml under the DOC. When you update your document, you can run javadoc.xml directly with Ant. After the selection is complete, you can find a directory DOC in Project is your javadoc, you want to write a good Javadoc a very good way to refer to Java API DOC. It is very important to develop a good programming habit, let alone this is not difficult.

Here is my code and comment I write blog. / * Created on 2004-7-25                                                                     ? - Code Style - Code Templates * / package com.north.ming;  / **  * @author P2800 *  * TODO to change the template for this generated type comment go to * WINDOW - Preferences - Java - Code Style - Code Templates * /                                                                                                                                                                                                                                    package com.north.ming; import java.io.IOException;  / **  * @author P2800 *  * TODO To change the template for this generated type comment go to WINDOW - Preferences - Java - Code Style - Code Templates * /                                                                                                                                 1. Private int ID; private string username; / ** * @Param id the coreid of the person   @Param Username the name of the person * You Should Use the constructor to create a person object                                                                                                                         public secondclass {THIS.ID = ID;  @ }      @ }       }} = =;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; {Return Username;} / **   @Param Username the username to set.                                                                                                                @ @ pa   @ @return true if ..... else false  @ @ @Return True IF .....

转载请注明原文地址:https://www.9cbs.com/read-132606.html

New Post(0)