Java Operators and Escape Sequences

Escape Sequence
Character Value
\n
Newline
\r
Carriage Return
\f
Form Feed
\t
Horizontal Tab
\b
Backspace

 

Operator Type Operation
~ integral bitwise complement
! boolean logical complement
% arithmetic remainder
<< integral left shift
>> integral right shift
>>> integral right shift with zero extension
&& boolean conditional AND
|| boolean conditional OR
& integral bitwise AND
^ integral bitwise XOR
^ boolean boolean XOR

An "OR" operation compares two binary values (or logical values) and if either is on/true the result is on/true:

Value
Operation
Value
Result
0
or
0
0
1
or
0
1
0
or
1
1
1
or
1
1

An "XOR" ("exclusive or") operation compares two binary values and if only one is true the result is true:

Value
Operation
Value
Result
0
xor
0
0
1
xor
0
1
0
xor
1
1
1
xor
1
0