How does Java jump out of the current multi-loop
This article mainly introduces the relevant knowledge of "how Java jumps out of the current multiple loop". Xiaobian shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "how Java jumps out of the current multiple loop" can help you solve the problem.
How does Java jump out of the current multiple loop? not recommended
Adding a marker A to the outermost layer and using break A; can jump out of multiple loops because it doesn't make your program more elegant, and often does the opposite. For example, if someone else defines this identifier somewhere you can't find it, it's easy to make the code difficult to read.
(Labeled break and continue statements are supported in Java, somewhat similar to goto statements in C and C++)
Write the identifier A: outside the multilayer circuit to jump out of the circuit.
The code is as follows:
public static void main(String[] args) { A: for(int i=0;i