Tokens
The smallest individual part or unit in a program is known as tokens.
Java has five kinds of tokens:
Keywords are the special reserved word in Java which conveys some special meaning to the compiler so they cannot be used as identifiers(names) for classes, methods, or variables.
Identifiers
Identifiers are user defined tokens.They are used for naming classes, methods, variables, packages and interface in a program.
Rules for Identifiers:
A Java literal is a sequence of character that represents constant value that is to be stored in a variable.
Java specifies 5 major Literals
The following ASCII characters are used as separators in Java
( )
{ }
[ ]
;
,
Operators
The following are the operators in Java
The smallest individual part or unit in a program is known as tokens.
Java has five kinds of tokens:
- Keyword
- Identifiers
- Literals
- Punctuators
- Operators
Keywords are the special reserved word in Java which conveys some special meaning to the compiler so they cannot be used as identifiers(names) for classes, methods, or variables.
Identifiers
Identifiers are user defined tokens.They are used for naming classes, methods, variables, packages and interface in a program.
Rules for Identifiers:
- Can consist of Alphabets, digit, underscore and dollar
- Must not start with a digit
- Case sensitive
- Can be of any length
A Java literal is a sequence of character that represents constant value that is to be stored in a variable.
Java specifies 5 major Literals
- Integer Literal
- Floating Point Literal
- Character Literal
- String Literal
- Boolean Literal
The following ASCII characters are used as separators in Java
( )
{ }
[ ]
;
,
Operators
The following are the operators in Java
No comments:
Post a Comment