Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package xyz.liudong;
- /**
- * 使用 break 跳出多层循环, break multilevel loop
- *
- * @author: liudong
- * @date: 2019/7/15
- * @java-version: 11
- */
- public class BreakLoop {
- public static void main(String[] args) {
- out:
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 5; j++) {
- System.err.println(i + j);
- if ((i + j) == 3) {
- break out;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement