Java Basic - Basic Operators
Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:
- Arithmetic Operators
- Relational Operators
- Bitwise Operators
- Logical Operators
- Assignment Operators
- Misc Operators
Tables
- The Arithmetic Operators
- The Relational Operators
- The Bitwise Operators
- The Logical Operators
- The Assignment Operators
- The Misc Operators
- Precedence of Java Operators
The Arithmetic Operators ⤴
+
(addition)-
(subtraction)*
(multiplication)/
(devision)%
(modulus)++
(increment)--
(decrement)
The Relational Operators ⤴
==
(equal to)!=
(not equal to)>
(greater than)<
(less than)>=
(greater than or equal to)<=
(less than or equal to)
The Bitwise Operators ⤴
&
(bitwise and)|
(bitwise or)^
(bitwise XOR)~
(bitwise compliment)<<
(left shift)>>
(right shift)>>>
(zero fill right shift)
The Logical Operators ⤴
&&
(logical and)||
(logical or)!
(logical not)
The Assignment Operators ⤴
The Misc Operators ⤴
Conditional Operator (?:) ⤴
variable x = (expression) ? value if true : value if false
instance of Operator ⤴
(Object reference variable) instanceof (class/interface type)
Leave a Comment