labeled for loop in java

Solutions on MaxInterview for labeled for loop in java by the best coders in the world

showing results for - "labeled for loop in java"
Enrico
04 Feb 2017
1
2	//WithLabelledLoop.java
3
4    class WithLabelledLoop
5    {
6        public static void main(String args[])
7        {
8            int i,j;
9
10            loop1:   for(i=1;i<=10;i++)
11            {
12                System.out.println();
13
14                loop2:   for(j=1;j<=10;j++)
15                {
16                    System.out.print(j + " ");
17
18                    if(j==5)
19                        break loop1;     //Statement 1
20                }
21            }
22        }
23    }
24
25    Output :
26
27                1 2 3 4 5
28
29