When would you write an infinite loop in Java? -


what practical applications infinite loops in java?

for example:

while(true){     //statements, loop never set false } 

when use this?

infinite in sense until changes want keep running. until user hits "exit" keep running program.

in example need in code break it.

if (this happens)  break end 

but might put boolean instead of counter < 1 in while loop. in example it's bad practice.

program guess age initialize age  while (age != 20)     guess user     age = guess user end 

Comments

Popular posts from this blog

What Are The Best Universities In The World?

Hard vs. Soft Water: What's The Difference?

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -