java--while循环

while( 布尔表达式 ) {

//循环内容

}

只要布尔表达式的值为True,循环体语句就会执行

package hello.demo;

public class hello2 {
public static void main(String[] args){
int x = 20;
while (x < 100){
System.out.println("value of x : "+x);
x++;
//System.out.println("\n");
}
}
}
posted @ 2021-02-27 11:12  朵朵奇fa  阅读(83)  评论(0编辑  收藏  举报