Yes I want to confirm about the error in the ANSWER CHOICE which says "join() and yield BOTH will produce required output".
but in Real World Only join() will work whereas yield will not produce desired output.
Why can't t1.yield() be chosen? Below is from Java 6 API for Thread.yield():
"public static void yield(): Causes the currently executing thread object to temporarily pause and allow other threads to execute."
I think yield() will cause current main thread to pause and gives t1 a chance to run.
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss