For this case, I'll still choose "No guarantee". It's possible that the main thread yields and is then reselected by the scheduler especially for threads with same priority (well, that's what K&B book says on pg 513 ).
Originally posted by rathi ji: Come-on Barry , It can't be dependent on IDE ... It may be because of your JVM .
I tried the same program in Eclipse and BlueJ with the same jdk and jre and found false and true output respectively. It can't be dependent on IDE as rathi said then why am i getting different output???
Like already stated, there are no guarantees so yield might not have the effect of getting the other thread to run at all. This is not IDE dependent, not JVM dependent, it's pure chance. One run might produce false, another true. Maybe you get true a thousand times and then false just once, there's just no telling.