Java Language / Operators in java

Operator is a symbol that is used to perform operations.

Expression
It is a equation where right hand side calculated value is assigned to left hand side.

Example: C=a+b; here

variables c, a, b
Operator +
operands a, b


Types of Operators in java
Operators Type Operator symbol
Unary Operators ++, --
Arithmetic Operators +,-,/,*
shift Operators <<,>>,>>>
Relational Operators <,>,<-,>=,==,!=
Bitwise Operators < > <= >= instanceof
Logical Operators ^, |, &&
Ternary Operators ? :
Assignment Operators =

Java Operator Precedence and Associativity
Operators Precedence Associativity
postfix increment and decrement ++ -- left to right
prefix increment and decrement, and unary ++ -- + - ~ ! right to left
multiplicative * / % left to right
additive + - left to right
shift << >> >>> left to right
relational < > <= >= instanceof left to right
equality == != left to right
bitwise AND & left to right
bitwise exclusive OR ^ left to right
bitwise inclusive OR | left to right
logical AND && left to right
logical OR || left to right
ternary ? : right to left
assignment = += -= *= /= %= &= ^= |= <<= >>= >>>= left to right


Home     Back