What does <<= mean in java

This is equivalent to += or -= or similar operators. The operator << makes a copy of the variable and shifts it left. You must then assign this to a variable or use it in some way. The code:

x << 2;

does nothing. You must use this value in some way:

x = x << 2;
x <<= 2;

These are equivalent statements.

Leave a Comment