java 中 while里有个if 想跳过本次循环继续,需要再if里写什么?

如题所述

写continue;
continue是表示结束本次循环,继续下一次循环。
break表示结束整个循环,继续执行循环后面的代码。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-05-22
/*
 * for me, this is a time, in which never write java code.
 * e-mail:qinchuanqing918@sina.com
 * data:2015/5/22
 * author:qcq
 * */
package com.nokia;


public class MapIter {

public static void main(String[] args) {
int counter = 0;
while(counter++ <= 100){
if (0 == counter % 2){
continue;
} else {
System.out.print(counter + ",");
}
}
}

}

本回答被网友采纳
第2个回答  2015-05-22
写continue

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网