Java Reference
In-Depth Information
TABLE 1.2
The Java Operators
Operator
Symbol and Precedence
expression++
,
expression--
Post-increment/post-decrement
++expression
,
--expression
Pre-increment/pre-decrement
+
,
-
,
~
,
!
Unary operators
*
,
/
,
%
Multiplication/division/modulus
+
,
-
Addition/subtraction
<<
,
>>
,
>>>
Shift operators
<
,
>
,
<=
,
>=
,
instanceof
Relational operators
==
,
!=
Equal to/not equal to
&
,
^
,
|
Bitwise AND, exclusive OR, inclusive OR
&&
,
||
Logical AND, OR
?
:
Ternar y operator
= += -= *= /= %= &= ^= |= <<= >>= >>>=
Assignment operators
The SCJP exam objectives specifi cally mention the following operators:
Assignment operators: =,
+=
and
-=
Arithmetic operators:
+
,
-
,
*
,
/
,
%
,
++
, and
--
<
,
<=
,
>
,
>=
,
==
, and
!=
The
instanceof
operator
Bitwise and logical operators:
&
,
|
,
^
,
!
,
&&
, and
||
The conditional operator
(?:)
The upcoming sections discuss each of these categories of operators and the details that
you need to know about the operators for the SCJP exam.
Relational operators:
The Assignment Operators
Java has 12
assignment operators
: the
simple assignment
= and 11
compound assignment
operators
:
+=
,
-=
,
*=
, and so on. An assignment stores the result of the right-hand side of
Search WWH ::
Custom Search