Hi can someone explain why result is 5 and not 10 ? We do change the value of x so how come it's not changed ? Is this because at this exact time the thread might not have been started to run yet ? I don't think that's the answer though but i haven't recieved any answer on this yet. Thank you.
Val SCJP <BR>going for SCJD
posted 15 years ago
Yes , it seems that only because the thread might not have been started yet.. the result is so.... if we introduce sleep of even 1 ms u will get 10.(i ran it so) i ran it with sleep(0)... it gave me 5.. I wonder what would a thread do for sleep(0)??? sreek