Java Reference
In-Depth Information
Operators
Operators are used to perform computation on variables or a set of variables. The most com-
mon operator is the assign operator. You assign a value to a variable using this operator. In
Java it is denoted as “=” (equal sign). This equal sign is not the same as it is used in Mathem-
atics. In Java the operator for equal is := =”. But most other operator do the same thing in
programming as they do in Mathematics. Some special operators are also created by carious
programming languages.
In the section on variables we have already seen the assign operator “=”.
Let us see some operators which are used in Java.
Table 1.1: Java operators
Operator description
Operators
Additive operator
+
Subtraction operator
-
Multiplication operator
*
Division operator
/
Reminder operator
%
Greater than
>
Less than
<
Equal to
==
Greater than or equal to
>=
Less than or equal to
<=
logical OR
||
logical AND
&&
bitwise inclusive OR
|
bitwise exclusive OR
^
Bitwise AND
&
equality
== !=
relational
< > <= >= instanceof
shift
<< >> >>>
Search WWH ::




Custom Search