What are Tokens in Java ?

Tokens are the smallest individual units in a program.

Tokens are also referred to as java program elements which are identified by the system compiler.

Tokens in java includes the following:

  • Keywords
  • Identifiers
  • Literals
  • Operators
  • Separators

A java program is basically a collection of classes. Is simple term, a java program is a collection of tokens, comments and white spaces.

Java Character Set

  • Java character set is a collection of alphabets, letters and some special characters which are valid in Java.
  • The character set are defined by Unicode character set.
  • The smallest units of Java language are the characters which is responsible for writing Java tokens.
  • These characters are defined by the Unicode character set, an emerging standard that tries to create characters for a large number of scripts worldwide.