标识符
字母_$ | 数字 | |
---|---|---|
开头 | √ | × |
组成 | √ | √ |
小驼峰命名法:方法、变量
name, firstName
大驼峰命名法:类名
Student, GoodStudent
常量
常量的声明与变量类似,只是在前面要增加关键字final,并且常量名要全部大写
public class Variable{
public static void main(String args[]){
final int HOURS = 24;
System.out.println(HOURS);
}
}