break;语句和 System语句的前后顺序有什么关系吗?
package com.imooc;
public class HelloWorld{
public static void main(String[] args){
int sum = 0;
for(int i= 1;i<= 10;i++){
sum = sum +i;
if(sum >20){
break;
}
}
System.out.println("当前的累计值为:"+sum);
}
}
package com.imooc;
public class HelloWorld{
public static void main(String[] args){
int sum = 0;
for(int i= 1;i<= 10;i++){
sum = sum +i;
if(sum >20){
break;
}
}
System.out.println("当前的累计值为:"+sum);
}
}
2017-02-22
举报