D Dr. No macrumors regular Original poster Sep 13, 2003 193 0 May 4, 2005 #1 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
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 macrumors 603 Jul 23, 2002 5,479 1 Holly Springs, NC May 4, 2005 #2 Dr. No said: 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 Click to expand... 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;
Dr. No said: 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 Click to expand... 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 Moderator emeritus Jul 28, 2003 6,995 10 Citizens Bank Park May 4, 2005 #3 sum += term; is short for: sum = sum + term; Edit: too slow