java一共有51个关键字,两个保留字。
(一)保留字:const,goto 暂时还未用到,以后可能使用的称为保留字
(二)关键字:java中所有关键字都是小写
1.定义类,接口,抽象类,枚举:
class,interface,abstract,enum,extends,implements
2.实例化对象:
new
3.与循环,条件相关:
for,while,do,if,else,switch,case,default
continue,break
4.数据类型相关:
byte,short,int,long,float,double,char,boolean,void
true,false,null ,return
5. 表示对象或者父类的:
this,super
6.异常相关:
try,catch,finally,throw,throws
7. 访问修饰符:
public,protected,private
8.静态,最终:
static,final
9.与包相关的关键字:
package,import
10. 判断对象是否是类的实例关键字:
instanceof
11.设置方法或一段代码是线程同步的。
synchronized
12. 输入输出流(对象流)
transient
13.标记字段可能会被多个线程同时访问,而不做同步:
volatile
14.浮点数比较使用严格的规则:
strictfp,
15.表示方法用非java代码实现:
native
16.断言:
assert