23. Java Keywords

 

The words shown in Table D.1 are reserved for use as Java keywords and cannot be used as identifiers. The keywords const and goto, which are C++ keywords, are not actually used in Java. They were included mainly to enable better error messages to be generated when they are mistakenly used in a Java program.

The words true, false, and null may look like keywords but are technically considered literals. They also cannot be used as identifiers.

 

TABLE D.1 The Java keywords cannot be used as names for identifiers.

 

abstract

continue

for

new

switch

assert

default

goto

package

synchronized

boolean

do

if

private

this

break

double

implements

protected

throw

byte

else

import

public

throws

case

enum

instanceof

return

transient

catch

extends

int

short

try

char

final

interface

static

void

class

finally

long

strictfp

volatile

const

float

native

super

while

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

821

 

 

 

 

 

 

 

 

 

 

 

Appendix E