Eclipse中自动添加注释

方法一:Eclipse中设置在建立新类时自动生成注释 


windows-->preference 
Java-->Code Style-->Code Templates 
code-->new Java files 
编辑它 

${filecomment} 
${package_declaration} 
/** 
* @author 做者 E-mail: 
* @version 建立时间:${date} ${time} 
* 类说明 
*/ 
${typecomment} 
${type_declaration} windows

方法二:.net

经过菜单 Window->Preference 打开参数设置面板,而后选择:
Java -> Code Style -> Code     Templates



在右侧选择Comments,将其中的Files项,而后选右边的"Edit",进入编辑模式:   



进入编辑模式后就能够自定义注释了。另外能够插入一些变量,如年、日期等等。



最后,确保 Code -> New Java files 中有:"${filecomment}"



固然,经过“导出”和“导入”功能,你能够把本身的模板导出来在其余机器上使用。




    以上是文件注释,类中的方法自动添加注释相似,对应于Files下面的Types。code

 

Eclipse快捷键:选中你的方法后alt+shift+Jblog

相关文章
相关标签/搜索