Java-Control Infinite Loop

Control Infinite Loop Using Break If you can force immediate termination of a loop, bypassing the conditional expression and any remaining code in the body of the loop. When a break statement is encountered inside a loop, the loop is terminated and program control resumes at the next statement following the loop. The break statement can be used with … Read more…

Java-Infinite For Loop

Infinite For Loop You can intentionally create an infinite loop, if you leave all three parts of the for empty. The general form is: This loop will run forever because there is no condition under which it will terminate. Although there are some programs, such as operating system command processors, that require an infinite loop, most “infinite … Read more…