+
-
*
/ (the whole part of division: in case both numbers are whole, the result will be whole)
/ (real division: in case at least one number is a floating-point number)
% (remainder after division, modulo operator)
a = b
a += b (a = a + b)
a -= b (a = a - b)
a *= b (a = a * b)
a /= b (a = a / b)
a %= b (a = a % b)
Results true or false value.
== (equals with)
!= (not equals with)
>
>=
<
<=
&& (AND)
| | (without space between them; OR)
! (NOT)
+n (unary plus, optional)
-n (unary minus, inverts the sign)
++n (prefix increment operator, 1st increases, then executes)
n++ (postfix increment operator, 1st executes, then increases)
--n (prefix decrement, 1st decreases, then executes)
n-- (postfix decrement, 1st executes, then decreases)
! (logical complement operator, inverts boolean variable)
int n = 5;
System.out.println(n++); //writes 5 then n == 6
System.out.println(++n); //n == 6 then writes 6
Operations on binary forms of numbers.
~ (invert, by bits, ~N = -(N+1))
<< (left shift)
>> (right shift)
>>> (unsigned right shift)
& (bitwise AND)
| (bitwise OR)
^ (bitwise exclusive OR == XOR)
EXAMPLE FOR OR:
EXAMPLE FOR INVERT:
instanceof (checks whether a variable is a member of class)
ternary (short solution for a simple "if" condition)
-> (lambda operator)
EXAMPLE FOR OTHER OPERATORS:
Chain equality: a = b = c is b = c, then a = b, therefore direction is <-