结合两道面试题写出的一道java题目,你做对了吗?
public static void main(String[] args) {int i=1;ok: while (1==1 & (i++)==1){for ( i=0 ; i <100 ; i++) {for (int j = 0; j <100 ; j++) {System.out.println(j);break ok;}System.out.println(i);}System.out.println("未跳出循环");}System.out.println(i);}public static void main(String[] args) { int i=1; ok: while (1==1 & (i++)==1){ for ( i=0 ; i <100 ; i++) { for (int j = 0; j <100 ; j++) { System.out.println(j); break ok; } System.out.println(i); } System.out.println("未跳出循环"); } System.out.println(i); }public static void main(String[] args) { int i=1; ok: while (1==1 & (i++)==1){ for ( i=0 ; i <100 ; i++) { for (int j = 0; j <100 ; j++) { System.out.println(j); break ok; } System.out.println(i); } System.out.println("未跳出循环"); } System.out.println(i); }
© 版权声明
THE END
暂无评论内容