| class WhileDemo {
 public static void main(String[] args)
 {
 int x=3;
 while (x<4) //此处可以设计一下x的值 x<4 来验证
 System.out.println("while run");
 System.out.println("while ifornot run");
 System.out.println("while not run");
 }
 }
 
 //通过验证可以发现 while和if一样 当不带大括号时是可以的  默认下一句是它大扩号的内容  再以下就不是了
 
 不知道对您有帮助没有?
 |