View Full Version : Quick Java question
Dr. No
May 4, 2005, 09:48 PM
Can anyone here tell me what the Java shortcut "+=" does?
As in:
int term = 1;
int sum = 0;
sum += term;
Thanks- I am preparing for my computer science final :)
jeremy.king
May 4, 2005, 09:53 PM
Can anyone here tell me what the Java shortcut "+=" does?
As in:
int term = 1;
int sum = 0;
sum += term;
Thanks- I am preparing for my computer science final :)
it adds the operand on the right to the operand on the left and reassigns the result to the left.
in your example, its the same as
sum = sum + term;
grapes911
May 4, 2005, 09:53 PM
sum += term; is short for:
sum = sum + term;
Edit: too slow :o
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.