for循环只要一断开,就彻底断开了,不存在之后又因为条件满足,而又运行起来了。 int[] arr = {1,1,1,2,2,1,1,1}; for (int i = 0; i < arr.length && arr[i] != 2; i++) { System.out.println(i); }