方法一:Eclipse中設置在建立新類時自動生成註釋
windows-->preference
Java-->Code Style-->Code Templates
code-->new Java files
編輯它
windows
${filecomment}
${package_declaration}
/**
* @Author fufu
* @Time ${date} ${time}
* @Version 1.0
* <p>Description:</p>
*/
${typecomment}
${type_declaration} 3d
方法二:code
經過菜單 Window->Preference 打開參數設置面板,而後選擇:
Java -> Code Style -> Code Templatesblog
在右側選擇Comments,將其中的Files項,而後選右邊的"Edit",進入編輯模式: ip
進入編輯模式後就能夠自定義註釋了。另外能夠插入一些變量,如年、日期等等。it
最後,確保 Code -> New Java files 中有:"${filecomment}"io
固然,經過「導出」和「導入」功能,你能夠把本身的模板導出來在其餘機器上使用。模板
以上是文件註釋,類中的方法自動添加註釋相似,對應於Files下面的Types。變量