java For 循环 运行顺序

 

运行结果:

a
b
i love java
c
b
i love java
c
b
i love java
c
b
i love java
c

 

结论:先运行赋值语句i--->条件判断--->执行下面语句--->改变数值i--->条件判断...........循环 直到条件不满足

 

另一种for循环

public class One {
  public static void main(String args[]){
    String[] runnoobs = new String[3];
    runnoobs[0] = "one";
    runnoobs[1] = "two";
         runnoobs[2] = "three";
    for(String i:runnoobs){
      System.out.println(i+"\n");
    }
  }
}

 

posted on 2018-07-10 13:39  秋天很好  阅读(370)  评论(0编辑  收藏  举报

导航