for (int i = 1; i <= 10; i++) { if (i == 4) { break; } System.out.println(i); } // Output: // 1 // 2 // 3
Click Run to execute this code.