问题
I got this question in an interview that what's the impacts of declaring expression sum+=i; or sum = sum+i; inside the loop.
    int sum = 0;
    for (int i = 0; i <= 100; i++) {
        sum = sum + i; //Expression 1
        sum += i;  //Expression 2
    }
    回答1:
In this example, there is no difference whatsoever other than what you consider easiest to read.
来源:https://stackoverflow.com/questions/66162802/pros-and-cons-of-declaring-expression-in-java-sum-i-instead-of-sum-sum