+1 vote
in JAVA by
How is an infinite loop declared in Java?

1 Answer

0 votes
by

Infinite loops are those loops that run infinitely without any breaking conditions. Some examples of consciously declaring infinite loop is:

Using For Loop:

for (;;)

{

   // Business logic

   // Any break logic

}

Using while loop:

while(true){

   // Business logic

   // Any break logic

}

Using do-while loop:

do{

   // Business logic

   // Any break logic

}while(true);

Related questions

0 votes
asked Feb 12, 2020 in JAVA by rahuljain1
0 votes
asked Oct 22, 2020 in JAVA by sharadyadav1986
...