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));
}
}
}
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内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复