Compound assignment and ++
x += 5 is short for x = x + 5, so each compound operator does its arithmetic with the old value and stores the result, and x++ adds one the same way.
From AP Computer Science A.
x += 5 is short for x = x + 5, so each compound operator does its arithmetic with the old value and stores the result, and x++ adds one the same way.
From AP Computer Science A.