A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Keywords, identifiers, operators, Separators, literals.
Java character set: Characters are the smallest unit of java language. These are used to write java tokens. Java characters are defined by Unicode character set.
Keywords are words which belong to java language. They have standard predefined meaning. These words should be used only for their intended purpose. The Keywords should be written in lowercase. Some of the keywords are:
For, do, while, goto, if, else, int, char, byte, switch, void, try, catch, public, protected, private, static, throw, throws.
Identifiers are names given to classes, methods, variables, objects, arrays, packages and interfaces in a program. These are user defined names.
Identifiers are formed with alphabets, digits, underscore and dollar sign characters.
The first character must be an alphabet.
They can be any length.
They are case sensitive.
Literals are names that represent constant values. A constant is a quantity that does not change during program execution. There are five types of literals. They are
An operator is a symbol which represents some operation that can be performed on data. There are eight operators in java. They are
Arithmetic operators, Relational operators, Logical operators, Short hand assignment operators, Increment and decrement operators, Conditional operator, Bitwise operators, special operators.
Separators are symbols which belong to java language. These are used to indicate where group of codes are divided and arranged. There are six operators available. They are