Run ❯
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
public class Main { public static void main(String[] args) { // Outer loop. for (int i = 1; i <= 2; i++) { System.out.println("Outer: " + i); // Executes 2 times // Inner loop for (int j = 1; j <= 3; j++) { System.out.println(" Inner: " + j); // Executes 6 times (2 * 3) } } } }
Outer: 1
Inner: 1
Inner: 2
Inner: 3
Outer: 2
Inner: 1
Inner: 2
Inner: 3