What is the /= operator in Java?

It’s a combination division-plus-assignment operator.

a /= b;

means divide a by b and put the result in a.

There are similar operators for addition, subtraction, and multiplication: +=-= and *=.

%= will do modulus.

>>= and <<= will do bit shifting.

Leave a Comment