Break And Continue Of Java
2009-07-27 13:52
405 查看
Break And Continue
×A plain continue gose to top of the
innermost loop and continue.
×A labeled continue gose to the label
and re-enter the loop right after that
label.
×A break "drop out of the bottom" of
the loop.
×A labeled break drops out of the bottom
of the end of the loop denoted by the label.
Case:LabeledFor.java
//Break和Continue是带标号的
//LabeledFor
×A plain continue gose to top of the
innermost loop and continue.
×A labeled continue gose to the label
and re-enter the loop right after that
label.
×A break "drop out of the bottom" of
the loop.
×A labeled break drops out of the bottom
of the end of the loop denoted by the label.
Case:LabeledFor.java
//Break和Continue是带标号的
//LabeledFor
public class LabeledFor{ public static void main(String[] args){ int i=0; outer:/*相当于C中的loop, 1、java中限制在loop后不可在加其他东西 2、此loop必须在某循环语句前 3、下面这一循环的名字叫outer,给循环命名*/ for(;true;){ inner: for(;i<10;i++){ System.out.println("i="+i); if(i==2){ System.out.println("Continue"); continue;} if(i==3){ System.out.println("continue inner"); continue inner;//跳出inner循环,只可用于跳出 } if(i==4){ System.out.println("break outer"); break outer;//跳出outer循环,只可用于跳出 } } } } }
相关文章推荐
- continue and break for java
- Java breakand continue
- java中break,continue,return使用方法
- Java 中break 和 continue在循环中的作用
- The ins and outs of using Java with Domino
- break and continue
- java语法 break和continue作用
- Java中break return continue 区别
- 关于Java的return continue break语句的讲解
- Java中的break和continue 区别
- java中的标签(结合continue和break)
- java记——continue和break的区别(加强版)
- 【JAVA学习】java中break与continue
- Java_23_break_continue_一般用于循环_带标签的break&continue_goto关键字
- Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
- java--continue和break的简单使用
- The Essence of Object-Oriented Programming with Java and UML
- java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' 异常处理,及MySQL数据库编码设置
- java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,C
- Java的goto:标签+break/continue