What is Augmented assignment operator ?
Augmented operator is shortcut operator which is used to make easy coding.
When we want to save opration in the same variable like
int x=10;
int y=2;
x+=y;
System.out.println(x);
Output:
12
here , we have used x and y variables for oprations and then rexpress result in terms of one of those variable.
here is some augmented operators:
Get Prachi patel’s stories in your inbox
Join Medium for free to get updates from this writer.
+= | a += 1 | a = a + 1
-= | a -= 1 | a = a -1
*= | a *= 1 | a = a * 1
/= | a /= 1 | a = a /1
%= | a %= 1 | a = a %1
It is used to make program easy and short.
For example:-
instead of writing :
x =x + 5;
we can write:
x+=5;
Let me know if you have any doubt.









