实践三:认识标识符和关键字
1.简单认识标识符:
Question:什么是标识符?
Answer:Java中每一个部分都需要名字,像类名、变量名、方法名都是标识符,标识符是用来识别身份的。
2.注意点:
- 不能以关键字为变量或者方法取名
- 所有的标识符都应该以字母,美元符或下划线开始
- 首字符之后可以使用字母,美元符,下划线或数字的任何字符组合
- 标识符是大小写敏感的
- 可以用中文名命名,但一般不这样用
3.实践
4.总结:常用的关键字
列1 | 列2 |
---|---|
abstract | assert |
case | catch |
continue | default |
enum | extends |
for | goto |
instanceof | int |
new | package |
return | strictfp |
switch | synchronized |
transient | try |
boolean | break |
byte | char |
class | const |
do | double |
else | final |
finally | float |
if | implements |
import | interface |
long | native |
private | protected |
public | short |
static | super |
this | throw |
throws | void |
volatile | while |