1.关键字
| abstract | assert | boolean | break | byte |
|---|---|---|---|---|
| case | catch | char | class | const |
| continue | default | do | double | else |
| enum | extends | final | finally | float |
| for | goto | if | implements | import |
| instanceof | int | interface | long | native |
| new | package | private | protected | public |
| return | strictfp | short | static | super |
| switch | synchronized | this | throw | throws |
| transient | try | void | volatile | while |
【注意】Java 所有的组成部分都需要名字。类名,变量名以及方法名都被称为标识符。
2.标识符
-
所有的标识符都应该以字母(A-Z或者a-z),美元符($),或者下划线(_)开始
-
首字母之后可以是字母(A-Z或者a-z),美元符($),或者下划线(_)或数字的任何字符组合
-
不能使用关键字作为变量名或方法名
-
标识符是大小写敏感的
-
合法标识符举例:age,$salary,_value,__1_value
-
非法标识符举例: 123abc,-salary,#abc
public class Demo01 {
public static void main(String[] args) {
String 王者荣耀 = "百星王者";
// String 王者荣耀 = "倔强青铜";
System.out.println(王者荣耀);
//大小写十分敏感
String Man = "xiexiaoran";
String man = "xiexiaoran";
String name = "xiexiaoran";
String Ahello = "xiexiaoaran";
String hello = "xiexiaoaran";
String $hello = "xiexiaoaran";
String _hello = "xiexiaoaran";
String _ ="xiexiaoran";
//String class ="xiexiaoran";
//String 1hello = "xiexiaoaran"
//String #hello = "xiexiaoaran"
//String *hello = "xiexiaoaran"
}
}



