What is the output of the following Java code?

Last Updated :
Discuss
Comments

What is the output of the following Java code?

Java
for (int i = 0; i < 5; i++) {     if (i == 2)         break;     System.out.print(i + " "); } 


0 1 2 3 4

0 1


0 1 2

No Output

Share your thoughts in the comments