Java Loops Infinite - thelastmile/FreeCodeCamp GitHub Wiki

Java Infinite Loops

If you want your loop to go on infinitely, you can use the while, do while and for statement.

// Infinite For Loop
for ( ; ; )
{
    // your code here
}

// Infinite While Loop
while (true)
{
    // your code here
}

// Infinite Do While Loop
do
{
    // your code here
}
while (true);

Previous