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 loops” are really just loops with special termination requirements.



Program Source

class Javaapp {

    public static void main(String[] args) {
        for( ; ; )
            System.out.println("infinite for loop");

Leave a Comment