Incremental Java infinite loop

Java Programming Java8Java Technologies Object Oriented Programming

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.



raja
Published on 23-Apr-2018 16:33:16
Advertisements