+ 2
what the line sum+= do?
4 ответов
+ 2
No it's not like that....
look...
if you are writing '
int sum=0;
sum+=3;
//that means.: sum=sum + 3;
//sum=0+3; I.e. sum = 3 ( sum will get new value as 3)
whatever the answer comes it will be stored into the sum again and sum will get new value as an answer.
+ 2
sum+= x;
is the same like
sum = sum + x;
You can also use: -=, /=, *=, %=
+ 2
Ok 😂
0
it's same as
sum=sum+
example:
int sum=0,
sum+=3;
System.out.print(sum); //3