package javaLearnings;
import java.util.Scanner; public class Main { public static void main(String args[]){ /* When used inside a set of nested loops, the break statement will only break out of the innermost loop */ for(int i=0; i<3; i++) { System.out.print("Pass " + i + ": "); for(int j=0; j<100; j++) { if(j == 10) break; // terminate loop if j is 10 System.out.print(j + " "); } System.out.println(); } System.out.println("Loops complete."); } } |