javadoc标记参考

所有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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值