访问控制:
private 私有的
protected 受保护的
public 公共的
类、方法和变量修饰符
abstract 声明抽象
class 类
extends 扩允,继承
final 终极,不可改变的
implements实现
interface 接口
native 本地
new 新,创建
static 静态
strictfp 严格,精准
synchronized 线程,同步
transient 短暂
volatile 易失
程序控制语句
break 跳出循环
continue 继续
return 返回
do 运行
while 循环
if 如果
else 反之
for 循环
instanceof 实例
switch 开关
case 返回开关里的结果
default 默认
错误处理
catch 处理异常
finally 有没有异常都执行
throw 抛出一个异常对象
throws 声明一个异常可能被抛出
try 捕获异常
包相关
import 引入
package 包
基本类型
boolean 布尔型
byte 字节型
char 字符型
double 双精度,
float 浮点
int 整型
long 长整型
short 短整型
null 空
true 真
false 假
变量引用
super 父类,超类
this 本类
void 无返回值
---------------------------------------------------------------------
Java语言有51个保留关键字,其中const和goto虽然被保留但未被使用。你不能使用保留关键字来命名类、方法或变量。
一、保留关键字
数据类型:
Boolean int long short byte float double char class interface
流程控制:
if else do while for switch case default break continue return try catch finally
修饰符:
public protected private final void static strictfp abstract transient
synchronized volatile native
动作:
package import throw throws extends implements this Super instanceof new
保留字:
true false null goto const
二、访问修饰符:
访问修饰符: public , protected , private
* 只能应用于类的成员变量。(局部变量只能在函数的范围内可见,不能使用访问修饰符)
* 能够用来修饰类本身。(protected , private 不能用于顶级类,只能用于内部类)
* 能够应用于成员方法和构造函数。
下面是一个例子:
package Examples;
public class HelloWorld02{
//以下定义了三个了类成
JAVA关键字的作用 来自淘豆网www.taodocs.com转载请标明出处.