Incremental Java infinite loop


Example

Following is the required program −

Live Demo

public class Tester {
   public static void main(String args[]) {
      int i = 0;
      do {
         i++;
         System.out.println(i);
      }while (true);
   }
}

The output will keep printing numbers in sequential order.



Updated on: 12-Mar-2020

112 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements