The first two loops continue without stopping because the test condition is true. NOTE: any code after either of these two for loops will not be reachable and therefore will not compile.

       for (int x=0;;x++){
            System.out.println(x);
      }
       for (int y=0; true ;y++){
            System.out.println(y);
      }
    for ( ; ; ) {
         // your code goes here
    }
       for ( ; true ; ) break;

Leave a comment