Java Program For Break and Label Break vs Continue and Label Continue
Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java
Program 1
package testcoreproject; public class TestCoreProject { public static void main(String[] args) { int i,j; one:for(i=1;i<=5;i++) { two:for(j=1;j<=5;j++) { System.out.print(i+" "+j); System.out.println(); if(i==j) break one; } System.out.println(); } } }
Program 2
package testcoreproject; public class TestContinue { public static void main(String[] args) { int i,j; one:for(i=1;i<=5;i++) { two:for(j=1;j<=5;j++) { if(i==j) continue one; System.out.print(i+" "+j); System.out.println(); } System.out.println(); } } }
Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google