CJCoding With Joseph
15free / daySign inCreate account
โ† 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