Assignment operator is a binary operator. It acts on two operands. The expression on right hand side evaluates first and then that value is assigned to the operand on left hand side.
Example : int x = 5+3;
Assigns 8 to x.
Shorthand assignment operators are used to present a statement in a shorter way. Below table shows the list.
|Original Statement||Shorter Way||Operator||Name of Operator|
|a = a + b||a += b||+=||Addition Assignment|
|a = a – b||a -= b||-=||Subtraction Assignment|
|a = a * b||a *= b||*=||Multiplication Assignment|
|a = a/b||a /= b||/=||Division Assignment|
|a = a%b||a %= b||%=||Remainder Assignment|