Eclipse sets the annotation template and calls out the annotation shortcut

Source: Internet
Author: User

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 !!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.