what is the output for the program for(;;) java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

what is the output for the program for(;;) java

public class Main { public static void main(String []args) { for(;;) { int i=0; if(i==1) { System.out.println(i); break; } ++i; } } }

29th Dec 2018, 4:53 PM
Techie Praga
Techie Praga - avatar
4 Answers
+ 5
Why don't you try to learn it on Sololearn playground? You can learn your code and see the output. And then if you don't understand, you can ask us for sure. It is a simple loop. In this loop initialization, condition and iteration is break down into parts.
29th Dec 2018, 5:05 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Simple loop, but this one is infinite, never gonna break.
29th Dec 2018, 6:41 PM
Michal
Michal - avatar
+ 1
It's a simple loop which print i, (0) and then break the loop. The ++i doesn't occur by the "break" sentence written before
29th Dec 2018, 5:11 PM
David Rueda 🇪🇸
David Rueda  🇪🇸 - avatar
0
It goes infinite ,but never break
30th Dec 2018, 5:39 AM
Parthi
Parthi - avatar