1 标识符有字母、数字、下划线组成
2 严格区分大小写
3 不能去使用关键词
false | def | if | raise |
none | del | import | return |
true | elif | in | try |
and | else | is | while |
as | except | lambda | with |
assert | finally | nonlocal | yield |
break | for | not | class |
from | or | continue | global |
pass |
4 大驼峰 小驼峰 下划线书写法
小驼峰法
变量一般用小驼峰法标识。驼峰法的意思是:除第一个单词之外,其他单词首字母大写。譬如int studentCount=0;
变量myStudentCount第一个单词是全部小写,后面的单词首字母大写。
大驼峰法
相比小驼峰法,大驼峰法把第一个单词的首字母也大写了。常用于类名,函数名,属性,命名空间。譬如public class StudentInfomation;
补充: