1.

Which Java operator has the highest precedence?

Answer»

The operator PRECEDENCE in JAVA determines the order of evaluation for the operators in an expression. The Java operator that has the highest precedence can be seen from the table given below:

Operator
Sign
Associativity
Postfix
++ --
Left to Right
Unary
++ -- + - ! (type)
Right to Left
Multiplicative
* / %
Left to Right
Additive
+ -
Left to Right
Shift
>> &LT;< >>>
Left to Right
Relational
< > <= >=
Left to Right
Equality
== !=
Left to Right
Bitwise AND
&
Left to Right
Bitwise XOR
^
Left to Right
Bitwise OR
|
Left to Right
Logical AND
&&
Left to Right
Logical OR
||
Left to Right
Conditional
?:
Right to Left
Assignment
= += -= *= /= %= ^= |= >>= <<=  
Right to Left

As is obvious from the above table, the postfix operators (++ --) have the highest precedence in Java.



Discussion

No Comment Found