This Java program is also an example of an infinite loop that prints the word "Java" continuously. The loop condition while(true) always evaluates to true, meaning the loop will never exit. The program will continue to execute indefinitely until it is forcefully terminated.
As with the previous example of an infinite loop using a do-while loop, it is important to avoid writing infinite loops in programs, as they can cause the program to crash or consume excessive resources.
public class Infinite_While { public static void main(String[] args) { while(true) { System.out.println("Java"); } } }
Java Java Java Java Java Java . . . Infinite
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions