What is the operator?
- The operator is one type of Character and this character performs the action.
- Basically, the four types of character are common like arithmetic, bitwise, relational, and logical
- java is provided some additional operators
- Arithmetic Operator
- Assignment Operator
- Relational Operator
- Bitwise operator
- Logical Operator
- Shift operator
- Ternary Operator
- Short circuit operator
- instance of Operator
- Concatenation Operator
- Modulus Operator
- Increment Decrement Operators
- New operator
The above seven operators are a basic operator and the other is an additional operator in java
There is a different type of arithmetic operator in java
No | Operator | USD | Description |
---|---|---|---|
1 | + | A + B | Addition |
2 | - | A - B | Subtraction |
3 | A * B | Multiplication | |
4 | / | A/B | Division |
5 | % | A % B | Modulus |
6 | ++ | A++ | Increment |
7 | – – | B-- | Decrement |
some of the assignment operator in java
No | Operator | USD | Description |
---|---|---|---|
1 | = | c = a + b | Assigns value |
2 | += | A=A+B(a+=B) | Addition assignment |
3 | -= | B=B-a(b-=a) | Subtraction assignment |
4 | *= | c=c*a(C*=A) | Multiplication assignment |
5 | /= | b=b/a(B/=a) | Division assignment |
6 | %= | B=B%a(B%=a) | Modulus assignment |
No | Operator | USD | Description |
---|---|---|---|
1 | == | A == C | Equal to |
2 | != | A!=B | Not equal to |
3 | > | A>B | Greater than |
4 | < | c<A | Less than |
5 | >= | A>=B | Greater than or equal to |
6 | <= | A<=B | Less than or equal to |
4 ) Bitwise operator
No | Operator | USD | Description |
---|---|---|---|
1 | & | A & C | Binary AND |
2 | | | A|B | Binary or |
3 | ^ | A^B | Binary XOR |
4 | ~ | C~A | binary ones |
No | Operator | USD | Description |
---|---|---|---|
1 | && | A && B | Logical AND |
2 | || | A||B | Logical OR |
3 | ! | A!=B | Not |
6 ) Shift operator
No | Operator | USD | Description |
---|---|---|---|
1 | << | A<<B | Left shift |
2 | >> | A>>B | Right shift |
3 | >>> | A>>>B | Shift right zero fill |
7 ) Ternary Operator
No | Operator | USD | Description |
---|---|---|---|
1 | ? : | a?a:b | Ternary Operator |
8 ) Short circuit operator
Boolean And & or is that short circuit operator
No | Operator | USD | Description |
---|---|---|---|
1 | && | A && B | Boolean AND |
2 | || | A||B | Boolean OR |
9 ) instance of Operator
No | Operator | USD | Description |
---|---|---|---|
1 | instanceof | obj instanceof class | compare object & class |
10 ) Concatenation Operator
No | Operator | USD | Description |
---|---|---|---|
1 | + | 'String' + 'string' | concat operator |
11 ) Modulus Operator
it's already defined in the arithmetic operator
No | Operator | USD | Description |
---|---|---|---|
1 | % | A % B | Modulus operator |
12 ) Increment Decrement Operators
increment and decrement operator is already defined in the Arithmetic operator
No | Operator | USD | Description |
---|---|---|---|
1 | ++ | A ++ | increment |
2 | -- | A -- | decrement |
13 ) New operator
No | Operator | USD | Description |
---|---|---|---|
1 | new | new classname | new operator |
if u learn in deeply you can click on any number of operator and understand this operator.