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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -