<pre name="code" class="java"> /**
* @description 用以打印
* @author bruce wangyaohuibuaa@163.com
* @date 2016-4-26
*/
public class HelloWorld {
/**
* @use 成员变量
*/
protected String name;
public static void main( String[] args){
outer:
for( int i = 0; i < 10; i ++ ){
for ( int j = 0; j < 10; j++ ) {
System.out.println( i + " + " + j + " = " + (i+j) + '\n');
if( i + j >= 10 ){
continue outer;
}
}
}
System.out.println("/这里是分割线/");
for( int i = 0; i < 10; i ++ ){
for ( int j = 0; j < 10; j++ ) {
System.out.println( i + " + " + j + " = " + (i+j) + '\n');
if( i + j >= 10 ){
break;
}
}
}
}
}
上述代码,用continue和标签实现了break的功能,不过在效率方面,两者如何呢?