Operator(演算子)とOperand(被演算子)
x = a + b;
=, +のことをOperatorと呼び、x, a, bをOperandと呼ぶ。
Arithmetic operators(算術演算子)
| Operator | Meaning | Example |
| + | 数値の加算 | 3 + 5 // 8 |
| – | 数値の減算 | 10 – 7 // 3 |
| * | 数値の乗算 | 3 * 5 // 15 |
| / | 数値の除算 | 10 / 5 // 2 |
| % | 数値の剰余 | 10 % 4 // 2 |
| ++ | 前置加算 | x = 3; a = ++x; // aは4 |
| ++ | 後置加算 | x = 3; a = x++; // aは3 |
| — | 前置減算 | x = 3; a = –x; // aは2 |
| — | 後置減算 | x = 3; a = x–; // aは3 |
Assignment operators(代入演算子)
| Name | Shorthand operator | Meaning |
| Assignment(代入) | x = y | x = y |
| Addition assignment(加算代入) | x += y | x = x + y |
| Subtraction assignment(減算代入) | x -= y | x = x – y |
| Multiplication assignment(乗算代入) | x *= y | x = x * y |
| Division assignment(除算代入) | x /= y | x = x / y |
| Remainder assignment(剰余代入) | x %= y | x = x % y |
| Exponentiation assignment(べき乗代入) | x **= y | x = x ** y |
| Left shift assignment(左シフト代入) | x <<= y | x = x << y |
| Right shift assignment(右シフト代入) | x >>= y | x = x >> y |
| Unsigned right shift assignment(符号なし右シフト代入) | x >>>= y | x = x >>> y |
| Bitwise AND assignment(ビット論理積 (AND) 代入) | x &= y | x = x & y |
| Bitwise XOR assignment(ビット排他的論理和 (XOR) 代入) | x ^= y | x = x ^ y |
| Bitwise OR assignment(ビット論理和 (OR) 代入) | x |= y | x = x | y |
Data Type(データ型)の基本型と参照型によるAssignment(代入)の違い