java - Will while-loop stop mid-execution? -


when executing while loop, java check if parameter(s) true? example if while loop

while(k=7) {     thread.sleep(5000); } 

but during 5 seconds thread changes k 8, loop continue waiting or exit immediately?

no, check when execution path takes there. thus, check every 5 seconds in example.

if wanted notified immediately, have use wait(), notify(), or other synchronization method.

here example


Comments

Popular posts from this blog

c++ - protocol buffers - generate NON-inline accessors -

c# - issue attaching/adding an entity object which is detached from the DB Context? -