Reserved Words in Java
What is Reserved Words.
- 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.
Difference between Keywords and Reserved Literals
- If reserve words represents some functionality, then called Keywords.
- If reserve words represents some value, the called Reserve Literals.
Reserve Literals (3)
- true (boolean value)
- false (boolean value)
- null (Object reference value)
Keywords (50)
- Used Keywords (48)
- Unused Keyword (2)
- Goto
- Const
All 53 Reserved Words List
Data types (8)
- byte
- short
- int
- long
- float
- double
- boolean
- char
Flow Control (11)
- if
- else
- switch
- case
- default
- while
- for
- do
- break
- continue
- return
Modifiers (11)
- public
- private
- protected
- static
- final
- abstract
- synchronized
- native
- strictfp(1.2 V)
- transient
- volatile
Exception Handling (6)
- try
- catch
- throw
- throws
- finally
- assert (1.4 V)
Class Related Keywords (6)
- class
- interface
- extends
- implements
- package
- import
Object Related Keywords (4)
- new
- instanceof
- super
- this
Return type keyword (1)
- void
Other keywords (1)
- enum (1.5) (Used to define a group of named constants)
Unused Keywords
- goto
- const
Reserved Literals
- true (boolean value)
- false (boolean value)
- null (default value for object reference)
Properties of Reserved words
- All reserved words contains lowercase alphabets.
- strictfp, assert, enum are new keywords in java launched in 1.2, 1.4 and 1.5 version respectively.
Comments