When you encounter the need to jump out of the inner for loop in your project, do not execute the outer for loop remaining statements and start the next outer for loop issue directly.
I personally do not want to use variables to determine whether continue, and finally found that the problem can be solved by naming the for loop and then continue to a specific for loop.
So write an example below to record.
Gets the odd number that the second array in the first array does not have, the following code:
Int[] one = {1, 4, 2, 8, 5, 7};
Int[] Two = {3, 0, 5, 6, 8, 9};
w:for (int i = 0; i < one.length i++) {
if (One[i]% 2 = 1) {for
(int j = 0; J < Two.length; J +) {
I F (one[i] = = Two[j]) {
continue w;
}
}
System.out.println (One[i]);
}
This allows you to continue to the specified for loop, skipping the remaining statements in the outer loop.