`

if 和 while 语句的区别。

    博客分类:
  • JAVA
阅读更多

1:代码

 

写道
public class Test {

public static void main(String[] args) {

int whileInteger = 3,ifInteger = 3;

while(--whileInteger>=0){
System.out.println(String.format("while:第%s次打印", whileInteger));
}

if(--ifInteger>=0){
System.out.println(String.format("if:第%s次打印", ifInteger));
}

}

}

 

2:输入结果。



 

3:while是用来循环判断的。

  • 大小: 38.3 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics