Keyword , Literal and Identifier in Java



The words that have predefined meaning in java or the other words whose meaning is reserved in java are called keywords.


The keywords of java language must be specified in lowercase only.


The values that we store into a variable are called as literals.


Any name that is used for the purpose of identification is called identifier.

Keyword/ datatype                    Identifier/Variable              Literal data/value

int                                                   age                            =               23


Rules for Writing an Identifier

  1. An identifier can be a combination of alphabets, digits, underscore(_) and dollars($)
  2. An identifier must not begin with a digit. It can begin with either an alphabet or underscore or dollar
  3. Identifier should not contains any spaces
  4. The keyword of java language should not be used as identifier
  5. There is no restriction on the length of identifier, but it is recommended to write an identifier having not more than 16 characters
  6. The name of the identifier should be meaningful and appropriate to the application.

int x= 23; valid but not recommended

int custid=23; valid and recommended



Leave a Reply