AP Computer Science --- Java Operators

Operator Use Description
- -op Arithmetically negates op
+ op1 + op2 Adds op1 and op2; also used to concatenate strings
- op1 - op2 Subtracts op2 from op1
* op1 * op2 Multiplies op1 by op2
/ op1 / op2 Divides op1 by op2
% op1 % op2 Computes the remainder of dividing op1 by op2
++ op++ Increments op by 1; evaluates to the value of op before it was incremented
-- op-- Decrements op by 1; evaluates to the value of op before it was decremented
> op1 > op2 Returns true if op1 is greater than op2
>= op1 >= op2 Returns true if op1 is greater than or equal to op2
< op1 < op2 Returns true if op1 is less than op2
<= op1 <= op2 Returns true if op1 is less than or equal to op2
== op1 == op2 Returns true if op1 and op2 are equal
!= op1 != op2 Returns true if op1 and op2 are not equal
&& op1 && op2 Returns true if op1 and op2 are both true; conditionally evaluates op2
|| op1 || op2 Returns true if either op1 or op2 is true; conditionally evaluates op2
! !op Returns true if op is false
= op1 = op2 Assigns the value of op2 to op1
+= op1 += op2 Equivalent to op1 = op1 + op2
-= op1 -= op2 Equivalent to op1 = op1 - op2
*= op1 *= op2 Equivalent to op1 = op1 * op2
/= op1 /= op2 Equivalent to op1 = op1 / op2
%= op1 %= op2 Equivalent to op1 = op1 % op2