TOKENS
Types of Tokens in Java
- Keywords
- Identifiers / Variables
- Literals / Values
- Operators
- Separators/ Punctuators
Keywords: Keywords are reserved words that have special meaning for the compiler.
Example: class, int, public, float, new, for, if, switch etc.
The keywords of any programming language can not be used for naming any identifier.
Identifiers: Identifiers are the names given to a program or a part of the program.
The names given by the user to any variable or class or function are known as Identifiers.
Literals: Literals are constant values which are assigned to the identifiers.
In simple language it can be said that literals are the values that can be stored in any variable.
Operators: Operators are special symbols that operate on operands and give some result.
Example: int age = 15;
In the above example
int is a keyword (data type)
age is an identifier i.e. name given to a variable
= is an operator (assignment operator)
15 is a literal (integer literal)
No comments:
Post a Comment