int i=0; for(;;) { for(i=0;i<=5;i++) { System.out.println(i); } if(i>5) { break; } }
Answers
Answered by
10
don't ask these questions
Answered by
1
This is a block of code which will start its iteration from 0 and will continue till it reaches 5.
If the value of i is greater than 5, it forcefully comes out of the loop and will display the output on the output console.
The break statement is used to come out of the loop at that point. It is mainly used in switch case statements.
Similar questions