`
hcx_2008
  • 浏览: 117998 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

javadoc标记参考

    博客分类:
  • J2SE
阅读更多
所有javadoc标记都以@开头。每一个标记必须另起一行。

标记:

类或者接口前面的标记
@author author_name
    除非你在运行javadoc时包含 -author 选项,否则忽略该标记。
@version
    除非你在运行javadoc时包含 -version 选项,否则忽略该标记。

方法前面的标记
@param variable_name
    如果方法有一个以上的参数,则为每一个参数提供@param标记。将这些标记组合在一起。
@return description
    描述方法的返回值。
@exception fully_qualified_class_name description
@throws fully_qualified_class_name description
    列出和描述可能抛出的异常。完全限定类名是到异常类的超文本链接。如果方法可能抛出一个以上的异常类型,则为每个异常类提供@exception或者@throws .将这些标记组合在一起。

示例:

/**
* <p>This class store the value of two integers.</p>
* <p>This class is written for the purpose of demonstrating Javadoc
* comments. Javadoc comments for classes can be broken into two
* parts: a description part and a tags part.  This is the
* description part.  The parts should be separated by one empty
* comment line.</p>
* <p>Also, there should be no lines between the end of the Javadoc
* comment and the beginning of the entity it describes.</p>
*
* @author  Lily Hou
* @author  Sean Bufano
* @version  1.0.0
*/
public class TwoInts  {

    private int  first;
    private int  second;

    /**
     * Initializes both integers to <code>0</code>.
     */
    public  TwoInts()  {
        first = 0;
        second = 0;
    }

    /**
     * Initializes both integers to arguments.
     *
     * @param initialFirst  value to which field <code>first</code>
     *                    is initialized
     * @param initialSecond  value to which field <code>second</code>
     *                     is initialized
     */
    public  TwoInts(int  initialFirst, int  initialSecond)  {
        first = initialFirst;
        second = initialSecond;
    }

    /**
     * Computes the sum of the two integers.
     *
     * @return  the sum of the two integers
     */
    public int  sum()  {
        return  first + second;
    }

    /**
     * Increments the field <code>first</code> by the argument.
     *
     * @param value  the value by which field <code>first</code> will
     *               be incremented
     */
    public void  addToFirst(int  value)  {
        first += value;
    }
}






Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=528489
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics