循环语句

public class Xunhuan {
    public static void main(String[] args){
    int i = 1;
    System.out.println("Before the loop");
    int sum = 0;
    while(i<=100){ 
        /*条件判断
         * 1.boolean值
         * 3.条件运算符*/
        sum = sum + i;
        ++i;
    }
    System.out.println("The value of sum is "+sum);
    System.out.println("After the loop");
  }
}

posted @ 2016-08-13 15:48  特雷恩  阅读(91)  评论(0编辑  收藏  举报