Wednesday, October 14, 2009

Section 2.3. Keywords







2.3. Keywords

Table 2-3 contains the Java keywords. Two of them are reserved but not used by the Java language: const and goto. These C++ keywords are included as Java keywords to generate better error messages if they are used in a Java program. Java 5.0 introduced the enum keyword.

Java keywords cannot be used as identifiers in a Java program.


Table 2-3. Java keywords
abstractdoubleintsuper
assertelseinterfaceswitch
booleanenumlongsynchronized
breakextendsnativethis
bytefinalnewthrow
casefinallypackagethrows
catchfloatprivatetransient
charforprotectedtry
classifpublicvoid
constgotoreturnvolatile
continueimplementsshortwhile
defaultimportstatic 
doinstanceofstrictfp 


Sometimes true, false, and null literals are mistaken for keywords. They are not keywords; they are reserved literals.









No comments:

Post a Comment