CJCoding With Joseph
15free / daySign inCreate account
Back to Multiple Choice Quiz

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics

Loop Output

Java quiz · Question 3
mediumLoops

What is the output of this code?

Code

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