⭐Tokens:- Tokens are the smallest unit of program.
⭐Tokens can be classified as follows:.
1)Identifier
2)Keywords
3)Literals
4)Operators
5)Seprators
6)Comments
⭐Identifier:- Identifier is the name given to the java programs.
*Note:- Can't be Identifier's
⭐Keywords:- Keywords are Predefined words which has it's own meaning.
In java there are 50 Keywords Those
⭐Literals:- Literals are the values which is used in java programming language.
In Literals we have:-
1)Character Literals.('A','b','$') [Character Literal can be written only in single quotes' ']
2)String Literals.("AB","a","$123") [String Literal can be written only in double quotes" "]
3)Boolean Literal.(true,false) [Boolean Literal are case sensitive]
4)Number Literal.(Integer[1,22,33],Decimal[1.5,22.5,33.5]))
⭐Operators:- Operators are an symbol which is used to perform some operations on operands.
Operator Type | Category | Precedence |
Unary | Postfix | expr++, expr-- |
Prefix | ++expr, --expr | |
Arthemetic | Multiplicative | *, /, % |
additive | +, - | |
Shift | Shift | >>, <<, >>>, <<< |
Relational | Comparison | > ,< ,<= ,>= ,instance of |
Equality | == ,!= | |
Bitwise | Bitwise And | & |
Bitwise exclusive OR | ^ | |
Bitwise inclusive OR | | | |
Logical | Logical AND | && |
Logical OR | | | | |
Ternary | Ternary | ? : |
Assignment | Assignment | = ,+= ,*= ,%= ,&= ,^= |
/= ,\= ,<<= ,>>= ,>>>= |
⭐Seprators:- Seprators are used to seprate the given code.
In Seprators we have
1){}-Braces.
2)[]-Brackets.
3)()-Paranthesis.
4);-Semi-Colon.
5),-Comma.
⭐Comments:- Are used to provide additional information for the program.
In Comments we have.
1)Single Line Comments.
Syntax:- //
2)Block Comments
Syntax:- /* */