Reserved Words in Java

What is Reserved Words.

  1. In every language some words are already reserved to represent some action or meaning.
  2. For example in English some reserve words are listed below.
    1. Apple
    2. Run
    3. Cat
    4. Dog
    5. Eat
  3. Similarly in Java there are some words which meaning is already reserved, such words are called reserved words / keywords.
  4. In Java, Only 53 words are reserved words.

Difference between Keywords and Reserved Literals

  1. If reserve words represents some functionality, then called Keywords.
  2. If reserve words represents 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)
    1. Goto
    2. 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 (default value for object reference)

Properties of Reserved words

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

Comments

Popular posts from this blog

String in golang

Inline V/S Block Level Element

Arrays in C Language

Data Types in Go language

Printing in C programming

Variable Naming & Scope of Variable

Escape Sequence | Formatted Printing | Interview Questions

Floating point Data types in Go lang

Overview of Go lang

Literals in Java