2.3 Java 关键字/保留字

Java 关键字是 Java 语言保留供内部使用的,如 class 用于定义类。关键字也可以称为保留字,它们的意思是一样的,我们不能使用关键字作为变量名或方法名。

关键字的特点:

  • 关键字的字母全部小写。

  • 常用的代码编辑器对关键字都有高亮显示,比如现在我们能看到的 public、class、static 等。

abstract

assert

boolean

break

byte

case

catch

char

class

const

continue

default

do

double

else

extends

final

finally

float

for

goto

if

implements

import

instanceof

int

interface

long

native

new

null

package

private

protected

public

return

short

static

strictfp

super

switch

synchronized

this

throw

throws

transient

try

void

volatile

while

Last updated

Was this helpful?