Java Operators
The Java operators are special characters. Using operators, java performs operations with operands.
Java operators are:
- Arithmetic operators: + – * /%
- Assignment operator: =
- Comparison operators: < > <= >= == !=
- Logical operators: && || !
- Instanceof operator: new
- Unary operators: + – ++ —
- String concatenation operator: +
Arithmetic operators
| Operator | Description |
|---|
| + | Additive operator |
| – | Subtraction operator |
| * | Multiplication operator |
| / | Division operator |
| % | Remainder operator |
Assignment operators
| Operator | Description |
|---|
| = | Assignment operator |
Comparison operators
| Operator | Description |
|---|
| == | Equal to |
| != | Not equal to |
| > | Greater than |
| >= | Greater than or equal to |
| < | Less than |
| <= | Less than or equal to |
Logical operators
| Operator | Description |
|---|
| && | And |
| || | Or |
| ! | Not |
Unary operators
| Operator | Description |
|---|
| + | Plus operator |
| – | Minus operator |
| ++ | Increment operator; increments a value by 1 |
| — | Decrement operator; decrements a value by 1 |
Instanceof operator
| Operator | Description |
|---|
| new | Instanceof operator |
String concatenation operator
| Operator | Description |
|---|
| + | String concatenation operator |