A Java Program to show the use of Labeled Break Statement.
publicclass JAVA_034 { publicstaticvoid main(String[] args) { int nValues=50; System.out.println("The Prime Numbers from 1 to 50 are : "); OuterLoop: for(int i=1;i<=nValues;i++) { for(int j=2;j<i;j++) { if((i%j)==0) break OuterLoop; } System.out.println(i); } System.out.println("The rest of the Loop iterations were skipped as 4 is not a Prime Number"); } }