Member-only story

Tokens in Java

Smallest Elements of a Java Program

Nipuni Arunodi
3 min readOct 25, 2020
Photo by Element5 Digital on Unsplash

Java tokens are the smallest elements of a program that are meaningful to the compiler.

5 types of Tokens

  • Reserved Keywords
  • Identifiers
  • Literals
  • Operators
  • Separators

Reserved Keywords

Java reserved words are keywords that are reserved by Java functions or other uses that cannot be used as identifiers

  • Have standard, pre-defined meanings in Java.
  • Cannot be used as programmer-defined identifiers.
  • Reserved words use only lowercase letters.

This Include

Primitive data types: boolean, int, double, char, etc.

Storage modifiers: public, private, static, final, etc.

Control statements: if, else, switch, while, for, etc.

Built-in constants: true, false, null

Identifiers

An identifier is a string of alphanumeric characters that begins with an alphabetic character or an underscore character that is used to represent variables

--

--

No responses yet