Java Program - Infinite for loop
class InfiniteForLoop {
public static void main(String[] args) {
/*
* Its perfectely legal to skip any of the 3 parts of the for loop.
* Below given for loop will run infinite times.
*/
for (;;)
System.out.println("Hello");
/*
* To terminate this program press ctrl + c in the console.
*/
}
}
Output:
Hello
Hello
Hello
Hello
..
..
public static void main(String[] args) {
/*
* Its perfectely legal to skip any of the 3 parts of the for loop.
* Below given for loop will run infinite times.
*/
for (;;)
System.out.println("Hello");
/*
* To terminate this program press ctrl + c in the console.
*/
}
}
Output:
Hello
Hello
Hello
Hello
..
..
Comments
Post a Comment