Java Tokens
Overview
Java tokens are the smallest elements in the Java program. Java Compiler identifies tokens as the basic building blocks of the program. The compiler breaks program statements into Java tokens.
Java Tokens
Java supports five types of tokens. They are as follows:
- Keywords
- Identifiers
- Literals
- Operators
- Separators
Keywords
Keywords have a predefined meaning and purpose in the Java language syntax. We cannot use keywords as variables or identifiers because they already have a predefined meaning in the language syntax.
Identifiers
Identifiers are names of specific programming elements such as variables, methods, classes, etc. To declare an identifier we have to follow some rules.
Literals
A literal is a constant value in Java. Literals are categorized as integer literal, floating-point literal, character literal, string literal, and boolean literal.
Operators
An operator is a symbol instructing the Java compiler to perform a specific action on one or more operands.
Separators
Separators are the special symbols that indicate where code blocks are separated and arranged. Some of the separators are as follows:
- Braces {}
- Parenthesis ()
- Brackets [ ]
- Semicolon
- Comma
- Period
—
Java Tutorials
Java Tutorial on this website:
https://www.testingdocs.com/java-tutorial/
For more information on Java, visit the official website :