SHARE
TWEET

Untitled

a guest Jul 21st, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package xyz.liudong;
  2.  
  3. /**
  4.  * 使用 break 跳出多层循环, break multilevel loop
  5.  *
  6.  * @author: liudong
  7.  * @date: 2019/7/15
  8.  * @java-version: 11
  9.  */
  10. public class BreakLoop {
  11.  
  12.     public static void main(String[] args) {
  13.  
  14.         out:
  15.         for (int i = 0; i < 3; i++) {
  16.             for (int j = 0; j < 5; j++) {
  17.                 System.err.println(i + j);
  18.                 if ((i + j) == 3) {
  19.                     break out;
  20.                 }
  21.             }
  22.         }
  23.  
  24.     }
  25.  
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top