Hi Guys,
I am puzzled by the answer to this question.
Question is :
Question 44)
Given a reference called
t
to to a class which extends
Thread, which of the following will cause it to give up cycles to allow another thread to execute.
1) t.yield();
2) yield()
3) yield(100) //Or some other suitable amount in milliseconds
4) yield(t);
Answer provided is:
Answer to Question 44)
Objective 7.1)
yield is a static method inherited from object and causes whatever thread is currently executing to yield its cycles.
2) yield()
I thought the answer would be 1, since t is a reference to Thread, and yield() is a static method of the Thread class. yield() might work if it is called in a subclass of Thread. Right??