Summary of the use of break and continue keywords in Java

I Function and difference break is used to jump out of the current loop block (for, while, do while) or program block (switch). In the loop block, it is used to jump out of the loop body currently being cycled. In the program block, it is used to interrupt the comparison with the next case condition. Continue is used to end the execution of subsequent statements in the loop body and jump back to the beginning of the loop block to execute the next loop, rather than the loop body immediately. Second, for other purposes, break and continue can cooperate with the statement label use.

This is very simple. Let's give a comprehensive example to understand:

Operation results:

The above is a summary of the use of break and continue keywords in Java brought by Xiaobian. I hope you can support programming tips~

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>