CJCoding With Joseph
15per day
← Back to Question List
Java Code Walkthrough #19

For Loop with Break

easyLoops

📄 Code

Read carefully — what does this print?
1public class Main {
2 public static void main(String[] args) {
3 for (int i = 0; i < 10; i++) {
4 if (i == 4) {
5 break;
6 }
7 System.out.print(i + " ");
8 }
9 }
10}

🎯 Your Answer