在Java中转到For循环的下一个迭代 [英] GoTo Next Iteration in For Loop in java

查看:91
本文介绍了在Java中转到For循环的下一个迭代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java中有一个标记跳过for循环的其余部分吗?
像java中的 VB的继续

解决方案

continue;

继续; 关键字会开始下一个迭代调用



例如

  for(int i = 0; i <5; i ++){
if(i == 2){
continue;
}
System.out.print(i);



$ b $ p
$ b $ p

pre $ 0134






< /java/nutsandbolts/branch.htmlrel =noreferrer> Document

Is there a token in java that skips the rest of the for loop? Something like VB's Continue in java.

解决方案

continue;

continue; key word would start the next iteration upon invocation

For Example

for(int i= 0 ; i < 5; i++){
 if(i==2){
  continue;
 }
System.out.print(i);
}

This will print

0134


See

这篇关于在Java中转到For循环的下一个迭代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆