Java Tokens
A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Java Tokens:
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:
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:
Identifiers are names given to classes, methods, variables, objects, arrays, packages and interfaces in a program. These are user defined names.
Rules:
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:
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
Operators:
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:
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
|
You can also visit our Computer science homework help page and upload your question to get customized online homework-help in Java tokens |