Keywords

by Michael Thomas

(Tutorial Home Page)

by Michael Thomas

(Tutorial Home Page)

 

Topic Notes
Java's Reserved Words
(alphabetical order)

Keyword - is a reserved word that is used by the language.

* - not used yet
? - emailed from a reader - I need to verify.

  • abstract
  • boolean
  • break
  • byte
  • case
  • catch
  • char
  • class
  • *const
  • continue
  • default
  • do
  • double
  • else
  • extends
  • false
  • 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
  • true
  • try
  • void
  • volatile
  • while
Reserved words are case sensitive. Warning:   Java is case sensitive

Example: "null" is a keyword but "NULL" is not!!!

Reserved, not a keyword yet. Reserved word, but not a keyword (as of 1.2)
  • const
  • goto

Became a keyword as of 1.1

  • transient - as of JDK1.1
  • strictfp - as of JDK 1.2
Reserved Word vs Keyword. A reserved word is a word that is reserved for special use by the language.  Reserved words are system identifiers and cannot be used by the programmer as a user identifier.

Technically a keyword is a reserved word that is currently used by the language with a special purpose.

Therefore all keywords are reserved words, however some reserved words are not keywords yet.  The may be so at a later date.

Example: 

  • As of Java 1.2 (Java 2), the following are reserved words but not keywords:  const, goto
  • In Java 1.0 "transient" was a reserved word but not a keyword
  • In Java 1.1 the reserved word "transient" became a keyword.

WARNING !!! on the exam consider the term keyword & reserved word to be synonomous.  Therefore all "reserved words" can be called "keywords" !

Not Keywords or Reserced words - tricky words that may be on the test!

Not Keywords or Reserved Words
(Warning:  These will trick you on the exam!)

  • integer
  • superclass
  • open
  • close
  • elseif
  • zero
  • NULL
  • sizeof
  • malloc
  • FALSE
  • TRUE
  • endcase
  • enddo
  • endif