Java Reference
In-Depth Information
Chapter 2:
Operators and Expressions
Java is a very rich language in terms of operators it has. Java operators can be classified into
the following categories:
 Arithmetic Operator
 Relational operator
 Logical operator
 Assignment operator
 Increment-decrement operator
 Conditional operator
 Bitwise operator
 Other special operators
Arithmetic operators
These operators are used in constructing mathematical expressions. Java provides all the
common arithmetic operators used algebra including +,-,/,*,% . All these operators have the
same functionalities as in other languages.
Operator
Meaning
+
Unary plus or addition operator
-
Unary minus or subtraction operator
/
Division operator
*
Multiplication
%
Modulo Division (Remainder Operator)
Some example of arithmetic operators are as shown below:
P+q
P-q
p*q
p/q
p%q
-p/q
In the above given examples, p and q are known as operands and these p and q can be vari-
able or constants.
Integer arithmetic
Search WWH ::

Custom Search