Arithmetic Assignment operators in Java

The five arithmetic assignment operators are a form of short hand. Various textbooks call them "compound assignment operators" or "combined assignment operators". Their usage can be explaned in terms of the assignment operator and the arithmetic operators.

Compound OperatorSample ExpressionExpanded Form
+=x += 2x = x + 2
-=y -= 6y = y - 6
*=z *= 7z = z * 7
/=a /= 4a = a / 4
%=b %= 9b = b % 9

Code Snippet

//Arithmetic Assignment operators in Java

public class App {
    public static void main(String args[]) {
        int a = 123;

        System.out.println(a);
        a += 10;
        System.out.println(a);
        a -= 10;// a=a-10
        System.out.println(a);
        a *= 10;
        System.out.println(a);
        a /= 10;
        System.out.println(a);
        a %= 10;
        System.out.println(a);
    }
}