Saturday, 25 July 2009

Java Certification Question 0044

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 :

yield is a static method inherited from Thread and causes whatever thread is currently executing to yield its cycles.

2) yield()

No comments: