我是靠谱客的博主 曾经星月,这篇文章主要介绍if 和 while 语句的区别。,现在分享给大家,希望可以做个参考。

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是用来循环判断的。

最后

以上就是曾经星月最近收集整理的关于if 和 while 语句的区别。的全部内容,更多相关if内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部