Method one: Settings in eclipse automatically generate comments when new classes are created
Windows-->preference
Java-->code Style-->code Templates
Code-->new Java Files
Edit it
${filecomment}
${package_declaration}
/**
* @author author E-mail:
* @version creation time: ${date} ${time}
* Class Description
*/
${typecomment}
${type_declaration}
Method Two:
Open the parameter Settings panel from the menu window->preference and select:
Java-code Style--code Templates
Select Comments on the right, place the files item, and then choose "Edit" on the right to enter edit mode:
After entering edit mode, you can customize the annotations. You can also insert some variables, such as year, date, and so on.
Finally, make sure that the Code-and New Java files have: "${filecomment}"
Of course, with the "Export" and "import" functions, you can export your own templates for use on other machines.
The above is a file comment, and the method in the class automatically adds a comment similar to the types below files.
Eclipse shortcut key: Alt+shift+j After you have selected your method.
Automatically add comments (author, time) in eclipse