Labeled for loop in java

Java Programming Language Decision Making and Looping in java (Article) Decision Making and Looping in java (Program)

1414

Program:

 public class LabeledForLoop {
public static void main(String[] args) {
  firstlooplebel:
    for(int i=1;i<=4;i++){
       secondlooplebel:
          for(int j=1;j<=4;j++){
               if(i==2&&j==2){
                  break firstlooplebel;
                 }
             System.out.println(i+" "+j);
           }
       }
   }
}

Output:

1 1
1 2
1 3
1 4
2 1
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.