Why infinite output ???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Why infinite output ????

My question is in the link below!! Please explain 🙏 https://www.sololearn.com/post/444210/?ref=app

20th Jun 2020, 4:35 AM
Reca Resu
Reca Resu - avatar
3 Answers
+ 4
It's same as: for(int i=0;i<5;){ System.out.print(i); } Because there is not any increment statement in the for loop, the i inside the for loop remains 0 forever(if you know about behavior of post-increment in assignments, then you will understand what i meant), which makes the for loop's condition true forever that's why it prints infinite 0's
20th Jun 2020, 5:02 AM
Bot
Bot - avatar
+ 3
Got it 👍Proলয় मिश्ra (chotu 👩‍💻)😃
20th Jun 2020, 5:04 AM
Reca Resu
Reca Resu - avatar
+ 3
Good to know that you got it😊
20th Jun 2020, 5:15 AM
Bot
Bot - avatar