當前位置:編程學習大全網 - 源碼下載 - Java中文檔註釋各字段的含義是什麽?例如author表示作者,para表示參數等

Java中文檔註釋各字段的含義是什麽?例如author表示作者,para表示參數等

常用Java註釋標簽(Java comment

tags)

@author 作者

適用範圍:文件、類、方法

(*多個作者使用多個@author標簽標識,java

doc中顯示按輸入時間順序羅列。)

例:*

@author Leo. Yao

@param 輸入參數的名稱 說明

適用範圍:方法

例:* @param str

the String用來存放輸出信息。

@return 輸出參數說明

適用範圍:方法

例: *

@return <code>true</code>執行成功;

* <code>false</code>執行失敗.

@since

JDK版本

用於標識編譯該文件所需要的JDK環境。

適用範圍:文件、類

例: * @since

JDK1.6

@version 版本號

用於標識註釋對象的版本號

適用範圍:文件、類、方法

例: * @version 1.0

@see 鏈接目標

表示參考。會在java 文檔中生成壹個超鏈接,鏈接到參考的類容。使用中的感覺是@see不需要包路徑,對我這種懶人比較喜歡,相對{@link

}這種既要加大括號,有需要包路徑,我還是選擇偷懶,當然妳要是不介意使用import導入要link的類,那就可以達到@see的效果,所以總體來說,還是選擇@see,當然兩個在特殊場合下還是用法不壹樣的

用法:

@see

#field

@see #Constructor(Type,

Type...)

@see #Constructor(Type id, Type

id...)

@see #method(Type,

Type,...)

@see #method(Type id, Type,

id...)

@see

Class

@see

Class#field

@see Class#Constructor(Type,

Type...)

@see Class#Constructor(Type id,

Type id)

@see Class#method(Type,

Type,...)

@see Class#method(Type id, Type

id,...)

@see

package.Class

@see

package.Class#field

@see

package.Class#Constructor(Type, Type...)

@see

package.Class#Constructor(Type id, Type id)

@see package.Class#method(Type,

Type,...)

@see package.Class#method(Type

id, Type, id)

@see

package

@throws 異常

標識出方法可能拋出的異常

適用範圍:方法

例: * @throws IOException If an input or output

exception occurred

@deprecated 解釋

標識對象過期

適用範圍:文件、類、方法

@link 鏈接地址

鏈接到壹個目標,用法類似@see。但常放在註釋的解釋中形如{@link …}

例:

/**

* @deprecated As of JDK 1.1,

replaced by

* {@link

#setBounds(int,int,int,int)}

*/

  • 上一篇:zepto.js和jquery.js函數都差不多啊,zepto.js有什麽優點呢?各位
  • 下一篇:commons.lang中有哪些常用的工具
  • copyright 2024編程學習大全網