JAVA TOKENS
DONE BY:
KAMESH G
21BIT226
BSC.IT_2ND YEAR
JAVA TOKENS
Following are the basic language building blocks:
1. Identifiers :
• Identifiers can begin with a letter, an underscore, or a currency character.
• After the first character, identifiers can also include digits.
• Identifiers can be of any length.
• JavaBeans methods must be named using camelCase, and depending on the
method’s purpose, must start with set, get, is, add, or remove.
KEYWORDS
• There are 49 reserved keywords currently defined in the Java language.
• These keywords, combined with the syntax of the operators and separators,
form the definition of the Java language.
• These keywords cannot be used as names for a variable, class, or method.
3.LITERALS
• A constant value in Java is created by using a literal representation of it.
For example,
• Here are some literals: 98.6 ‘X’ “This is a test”
• Left to right, the first literal specifies an integer, the next is a floating-point
value, the third is a character constant, and the last is a string.
• A literal can be used anywhere a value of its type is allowed.
4.WHITE SPACE
• • In Java, whitespace is a space, tab, or newline.
5.COMMENTS
• As mentioned, there are three types of comments defined by Java.
• You have already seen two: single-line and multiline.
• The third type is called a documentation comment.
• This type of comment is used to produce an HTML file that documents your
program.
• The documentation comment begins with
a /** and ends with a */.
6.SEPARATORS
• Separators are used to inform the Java compiler of how things are grouped in
the code.
• For example,
items in a list are separated by commas much like lists of items in a sentence.
• The most commonly used separator in Java is the semicolon.
• As you have seen, it is used to terminate statements.
• List of separators -> ; , { } ( ) [ ] .
7.OPERATORS :
• Operators means specify an evaluation to be performed on a data
(Operands).
• The operators supported by Java is as under :
* + – * / % & | ^ ~ && || ! < > <= >= << >> >>> = ? ++ — == += -= *= /= %= &= |=
^= != <<= >>= >>>= . [ ] ( )
•Thank you!