目录
1. 概述...........................................................................................................................................................................0
1.1. 编制说明.........................................................................................................................................................0
1.2. 适用范围.........................................................................................................................................................0
1.3. 参考文档.........................................................................................................................................................0
1.4. 术语解释.........................................................................................................................................................0
2. 命名规范...................................................................................................................................................................3
2.1. 包名.................................................................................................................................................................3
2.2. 类名.................................................................................................................................................................3
2.3. 方法名.............................................................................................................................................................4
2.4. 常量名.............................................................................................................................................................6
2.5. 变量名.............................................................................................................................................................6
2.6. 参数名.............................................................................................................................................................7
2.7. 局部变量名.....................................................................................................................................................8
3. 布局规范...................................................................................................................................................................9
3.1. 缩进对齐.........................................................................................................................................................9
3.2. 一行一个语句.................................................................................................................................................9
3.3. 行长度...........................................................................................................................................................10
3.5. 空行...............................................................................................................................................................11
3.6. 空格...............................................................................................................................................................12
3.7. 大括号...........................................................................................................................................................14
3.8. 圆括号...........................................................................................................................................................15
3.9. 布局补充.......................................................................................................................................................16
4. 注释规范.................................................................................................................................................................18
4.1. 整体要求.......................................................................................................................................................18
4.2. 块注释...........................................................................................................................................................20
4.3. 单行注释.......................................................................................................................................................21
4.4. 尾端注释.......................................................................................................................................................21
4.5. 类的注释.......................................................................................................................................................22
4.6. 方法注释.......................................................................................................................................................22
5. 语句规范.................................................................................................................................................................24
5.1. 简单语句.......................................................................................................................................................24
5.2. 复合语句.......................................................................................................................................................24
5.3. 返回语句.......................................................................................................................................................25
5.4. IF,IF-ELSE,IF ELSE-IF ELSE 语句...............................................................................................................25
5.5. FOR 语句........................................................................................................................................................27