Java continue 语句语句用来结束当前循环,并进入下一次循环,即仅仅这一次循环结束了,不是所有循环结束了,后边的循环依旧进行。
continue;
public class Test { public static void main(String args[]) { int [] numbers={10, 20, 30, 40, 50}; for(int x : numbers ) { if( x == 30 ) { continue; } System.out.print( x ); System.out.print("\n"); } } }
这将产生以下输出-
链接:https://www.learnfk.comhttps://www.learnfk.com/java/java-continue-statement.html
来源:LearnFk无涯教程网
10 20 40 50
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)