Home  >  Article  >  Java  >  Detailed introduction to graphic code details for automatically adding comments (two types) in Eclipse

Detailed introduction to graphic code details for automatically adding comments (two types) in Eclipse

黄舟
黄舟Original
2017-03-08 10:56:582078browse

This article mainly introduces two methods of automatically adding comments in Eclipse. It has a very good reference value. Let’s take a look at it with the editor.

Method 1: Set Eclipse to automatically generate comments when creating a new class

windows-->preference 
  Java-->Code Style-->Code Templates 
    code-->new Java files

Edit it

${filecomment} 
${package_declaration} 
/** 
* @Author fufu
* @Time ${date} ${time} 
* @Version 1.0
* <p>Description:</p>
*/ 
${typecomment} 
${type_declaration}

##Method 2:

Open the parameter setting panel through the menu Window->Preference, and then select:

Java -> Code Style -> Code Templates

Select Comments on the right, select the Files item, and then select "Edit" on the right to enter the editing mode:

After entering the editing mode Annotations can be customized. In addition, some variables can be inserted, such as year, date, etc.

##Finally, make sure Code -> New Java files contains: "${filecomment}"

Of course , through the "Export" and "Import" functions, you can export your own templates and use them on other machines.

Eclipse shortcut keys: After selecting your method, alt+shift+J



The above is the detailed content of Detailed introduction to graphic code details for automatically adding comments (two types) in Eclipse. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn