Java 基础 之 标识符
【摘要】 http://www.verejava.com/?id=1699254299287/*标识符的命名规则:1. 是以字母,数字,下滑线_和美元符号$ 组成2. 不能以数字开头3. 区分大小写4. 不能是java的保留关键字5. 最好是见名思意*/public class Identifier { public static void main(String[] args) { // 不能以数...
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);
}
}
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区),文章链接,文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件至:cloudbbs@huaweicloud.com进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容。
- 点赞
- 收藏
- 关注作者
评论(0)