Java and Android Annotation specifications

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/SharkBin/p/3999804.html

1. File Header Comment

Each file header must be a file header comment. Examples of file header annotations are as follows:

/* * File name: loginactivity*:    for user *:    * Time    : * Version    right: */

2. Method Header Comment

Each method header of a member method, including a custom member method, overriding method, property method, must make a method header comment.

Examples of custom member method annotations are:

/*
* Method Name: Login_click (View v)
* Function: Click the Login button event
* Parameters: View V-button view
* Return value: None
*/

Examples of overriding (overriding) member method annotations are as follows:

Examples of property getter and setter member method annotations are as follows:

3, block comment

Make a block comment before implementing the code for a phased function. A comment example for a block comment is as follows:

4. Variable Comment

All member variables and most local variables need to be commented on when declaring them.

A comment example of a member variable comment is as follows:

A comment example of a local variable comment is as follows:

5. Statement comment

Make a single statement comment to the right of the key statement.

A comment example of a statement comment is as follows:

6. Other Notes on the note

(1) File header and method header comments should use/**/form, variable comments and statement comments should use//form, block comments should try to use//form, when the text is longer (single horizontal can not be displayed completely) block annotations can also use the/**/form;

(2) The amount of comments must be not less than one-third of the total code;

Java and Android Annotation specifications

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.