Java identifiers


Identifiers:- Identifiers are the name given to the variable constant array method class etc. Java provides a specialised rule for different identifiers for these naming.

Java token:- Java token is the collection of variable, constant, data type, operator, expression, keywords, input-output statement etc. They are the building blocks of Java program that is used to develop the Java code and program.
Expression:- Expression is the collection of operator and operand that is used to perform different types of calculation and perform different types of calculation and processing.

There are two type of expression
1) Operator used
2) Technique

Operator used:-
a) Arithmetical expression
b) Relational expression
c) Logical expression
d) Mixed expression

Arithmetical expression:- Expression having only arithmetical operator is called as an arithmetical expression
a + b, a * b * c etc.

Relational expression:- Expression having only relational operator is called as a relational expression.
a > b, a < b, a = b etc.

Logical expression:- Expression having only logical operators is called as a logical expression.
a && b, a|| b

Mixed expression:- Expression having different types of an operator is called as a mixed expression.
a + b > c, a – b > c && d < f etc.

a) Simple expression
b) Compound expression

Simple expression:- Expression in which all the statements are independent of one another is called as a simple expression.
a = b + c, d = m * n, g = h / k

Compound expression:- Expression in which one or more statement depends on a particular statement is called as a compound expression. It is also called as a block. It is always written the braces {}.
a = b + c
d = m * n
g = h / k

Precedence of the operator:- In Java there are multiple types of an operator and in each type, there are multiple numbers of an operator. Then it is necessary to inform the weights to the operator called as precedence or priority. Priority specified the order in which operator will be evaluated. Higher precedence operator is evaluated first and lower precedence operator is evaluated after it.

Precedence level is as:-
1) Arithmetical
a) *, /, %
b) +, –
2) Relational
>, <, >=, <=, !=, ==
3) Logical
!, &&, ||

a) Higher precedence operator will be evaluated first and lower precedence operator will be evaluated after it.
b) If multiple operators of the same precedence come them they must be evaluated from left to right.
c) To change the precedence of the operator we use parathesis (U);
2 + 3 * 5 ( 2 + 3 ) * 5
2 + 15 5 * 5
17 25


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.