1Calling the yield method of the instance 2Calling the yield method of another thread 3 A call to the halt method of the Thread class 4 Another thread is given higher priority
The answer was given as 4. But I guess that it should be 1?? Any thoughts on that?
we can argue about answer one: Thread t = new Thread(); t.yield(); and
What can cause a Thread to stop executing?
1 Calling the yield method of the instance
You can say: "1 is true" Because you can call a static method through an instance. And the current thread may stop executing, when it hops over this lines. So it causes A thread to stop. The current thread is a Thread.
Or you can say: "1 is false" Because you cannot specify the thread that should yield because yield is a static method.
I would take the second, because the next given possible answer demonstrates, that Marcus Green was simply testing that we know, the yield method is static. But when you decide A is true, B must be true as well, because just some (specifically the current) thread may stop, when you call yield on any instance of Thread.