1. Set a comment Template
Choose Windows> preferences> JAVA> code style> code templates)
Then we can select comments (comments) in the right window, corresponding to the specific comments option, We can edit the specific comments.
For example, we want to set the author information and date information at the beginning of a Java file:
Select types (type), click Edit on the right, and set
/**
* @ Author $ {user}
* $ {Tags}
*/
Medium
"$ {User}" is deleted and changed to ** (the name information you want to automatically generate, for example, James). In this way, the author information is changed to ** (James). Click Insert.
Variable (Insert variable) button, select date, this will automatically generate date information, you can also insert time. After the setting is complete, we test that the automatically generated comments are:
/**
*
* @ Author Zhang San
* 11:12:05
*/
Similarly, you can customize the editing settings for comments such as constructors.
2. Call out the comment shortcutAlt + shfit + J
Place the focus of the cursor on the method name or class name, and then press Alt + shfit + J to OK !!