1. File Header Comment
Each file header must be a file header comment. Examples of file header annotations are as follows:
1 /* 2 * File name: loginactivity 3 * Description : 4 * For users :5 * hours :6 * Version Right:7 * /
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:
1 /* 2 * Method Name: Login_click (View v)3 * Power : Click the Login button event 4 * Number: View V-button View 5 * return value: None 6 */
Examples of overriding (overriding) member method annotations are as follows:
Examples of property getter and setter member method annotations are as follows:
3. block Annotations
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. Additional notes about annotations
(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