学Java· 标识符与关键字
标识符
举出例子:
package com.Test;
public class HellowWorld {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("hello world");
}
}
类名HellowWorld,就是标识符
标识符的命名规则:
1.字母、数字、下划线(_)、美元符($)组成,且不能数字开头。
2.不能够使用空格。
3.严格区分大小写。
4.不能使Java关键字和保留字,在eclipse中,紫色的字符串都是关键字,例如static、void。
常见错误:1helloworld、hello world
正确的示范:Void(首字母大写后不同于void)、HelloWorld_$123、void_class
关键字
不用死记硬背!