public static void testReturn() {
for (int i = 0; i < 10; i++) {
System.err.println(i);
if (i==5) {
return; //!=break; 因为break会跳出for循环继续执行后面代码
}
}
}
??输出: public static void testReturn() {
return;//一般都是省略
}
??
原文:http://shuizhaosi888.iteye.com/blog/2162750