很简单的一个输出问题
public class A1{public static void main(String args[]){
String output="";
int i;
for(i=1;i<=10;i++){
if(i==5){
continue;
}
output+=i+" ";
}
output+="\nUsing continue to skip printing 5";
output+="\ni="+i;
System.out.println(output);
}
}
输出如下:
1 2 3 4 6 7 8 9 10
Using continue to skip printing 5
i=11
问题:system.out.println(output)应该只输出i=11,为什么还会输出“1234678910”和“Using continue to skip printing 5”。求解谢谢