Javadoc:文件註釋常用引數
常見註釋型別 | 註釋含義 |
---|---|
@author | 類的作者 |
@version | 類的版本 |
@param | 方法的引數 |
@return | 方法的返回型別 |
@exception | 方法丟擲的異常 |
@see | 另外參照…… |
@since | 從什麼時候開始使用的 |
@date | 日期 |
@time | 時間 |
最常用設定物件
型別(Types)註釋標籤(類的註釋)
方法(Methods)標籤:(介面和其實現類的方法,都要加註釋)
Eclipse設定步驟


在這裡選擇目標型別,定製自己的個性化註釋即可,設定好以後選擇類名、方法名、欄位名加上快捷鍵Alt + Shift + J,即可生成個性化註釋。


【效果】在設定完以後,在new物件或者呼叫方法時,只要將滑鼠懸浮於該類或者方法名稱上,就能看到文件註釋的具體描述,更加方便觀察其功能。
IDEA設定步驟
IDEA比較細緻,但是也是比較繁瑣,主要關注配置的位置,設定都是類似的。
配置類的註釋
位置:File–>Settings–>Editor–>File and Code Templates–>Files


在這裡配置好以後建立類的時候會直接建立註釋,這裡相對Eclipse要方便一些。
配置方法的註釋
這個配置暫時不講了,它的配置步驟繁瑣,最根本的原因是不實用,原則上和欄位的文件註釋一樣,使用“/** + Enter”直接自定義寫註釋即可。