public class Test {
public static void main(String[] args) {
int sum = 0;
for (int i = 1; ; ++ i, sum += i) {
System.out.println("i = " + i + ", sum = " + sum);
if (i > 10)
break;
}
System.out.println(sum);
}
}
第 5 行的输出解释了为什么最后答案是 65.