CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

For Loop with Break

Java code walkthrough · Question 19
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