+ 1
+= means?
answer please
3 Respostas
+ 20
https://www.sololearn.com/learn/Java/2141/?ref=app
//3rd : assignment operators
+ 6
+= is shortened form for adding value in certain variable. For example "a = a + 2" is same as "a += 2"
+ 6
it's known as short hand assignment operator.
+= is used to add to values and store them in the 1st one variable.
int A=5, B=10;
A = A+B; //A=15
it can be written as,
int A=5, B=10;
A += B; //A=15
both will produce the same output. it's save the time and looks pretty cool.
there are some other assignment operators,
A+=B ~ A=A+B
A-=B ~ A=A-B
A*=B ~ A=A*B
A/=B ~ A=A/B
A%=B ~ A=A%B
A<<=B ~ A=A<<B
A>>=B ~ A=A>>B