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");
}
}
}

相关文章: