Java 基础 之 标识符

http://www.verejava.com/?id=1699254299287

/*
标识符的命名规则:
1. 是以字母,数字,下滑线_和美元符号$ 组成
2. 不能以数字开头
3. 区分大小写
4. 不能是java的保留关键字
5. 最好是见名思意
*/
public class Identifier
{
	public static void main(String[] args)
	{
		//不能以数字开头
		//int 1number=1;

		//标识符区分大小写
		int b=2;
		int B=3;
		System.out.println(b);
		System.out.println(B);
		//不能是java 的保留关键字
		//int class=4;
		
		//年龄最好见名思意
		int age=30;
		//两个字符串相连接用加号 +
		System.out.println("年龄是:"+age);

	}
}

http://www.verejava.com/?id=1699254299287

posted @ 2018-06-14 15:19  verejava  阅读(135)  评论(0)    收藏  举报