Java keywords

Keywords in Java

In every language, some words are already reserved to represent some action or meaning.

For example: In English, some reserve words are listed below.

  • Apple
  • Run
  • Cat
  • Dog
  • Eat

Similarly, In Java there are some words which meaning is already reserved, such words are called reserved words/keywords.

In Java, Only 53 words are reserved words.

reserved-words-in-java

Difference between Keywords and Reserved Literals

  1. If reserve words represent some functionality, then called Keywords.
  2. If reserve words represent some value, the called Reserve Literals.

Reserve Literals (3)

  1. true (boolean value)
  2. false (boolean value)
  3. null (Object reference value)

Keywords (50)

  1. Used Keywords (48)
  2. Unused Keyword (2)
  3. Goto
  4. Const

All 53 Reserved words list

Data types (8)

  1. byte
  2. short
  3. int
  4. long
  5. float
  6. double
  7. boolean
  8. char

Flow Control (11)

  1. if
  2. else
  3. switch
  4. case
  5. default
  6. while
  7. for
  8. do
  9. break
  10. continue
  11. return

Modifiers (11)

  1. public
  2. private
  3. protected
  4. static
  5. final
  6. abstract
  7. synchronized
  8. native
  9. strictfp(1.2 V)
  10. transient
  11. volatile

Exception Handling (6)

  1. try
  2. catch
  3. throw
  4. throws
  5. finally
  6. assert (1.4 V)

Class Related Keywords (6)

  1. class
  2. interface
  3. extends
  4. implements
  5. package
  6. import

Object Related Keywords (4)

  1. new
  2. instanceof
  3. super
  4. this

Return type keyword (1)

  1. void

Other keywords (1)

  1. enum (1.5) (Used to define a group of named constants)

Unused Keywords

  1. goto
  2. const

Reserved Literals

  1. true (boolean value)
  2. false (boolean value)
  3. null (the default value for object reference)

Keyword properties

  1. All reserved words contain lowercase alphabets.
  2. strictfp, assert, enum are new keywords in java launched in 1.2, 1.4, and 1.5 version respectively.

Java Keywords | Video Tutorial