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++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -