• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in JAVA by
Q:
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 Jan 24, 2020 in JAVA by rahuljain1
0 votes
asked May 4, 2021 in JAVA by SakshiSharma
...