Operators-Java
In General we can divide the Java Operators in 3 Categories (Always remebers that syntax of Java is Similar to C/C++.)
| Operators Type: | Operators | Comments |
| Arithmetic Operators: | +, -, *, /, %, ++, --, +=, -=, *=, /=, %= | +=, -=, *=, /=, %= are also known as Auto type cast operators. |
| Relational Operators: | >, >=, <, <=, =, ==, !=, !, instanceof, ?: | We will discuss 'instanceof' in Oops concepts. |
| Bitwise Operators: | ~, ^, &, |, >>>, <<, >>, &=, ~=, ^=, |= | >>> is also known as Arithmetic Right Shift,it preserve the sign bit. |
Please check following examples:
- byte x=5,y=12;
- x=x+y; // Error, x+y gives 'int', you can't assign 'int' to 'byte'
- x=(byte)(x+y); // Valid, Explicit Type casting
- x+=y; // Valid, Autotype cast
| Right Shift | Left Shift |
 |  |
| Arithmetic Right Shift | Arithmetic Right Shift |
 |  |