Two Laptop Bag
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Marcus green test#3, question #44 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Marcus green test#3, question #44" Watch "Marcus green test#3, question #44" New topic

Marcus green test#3, question #44

Christy Smith

Joined: Aug 15, 2001
Posts: 26
Hi Guys,
I am puzzled by the answer to this question.
Question is :
Question 44)
Given a reference called
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??
Mark Brossard

Joined: Aug 24, 2001
Posts: 3
Have a look at:
I agree. Here's the link:
subject: Marcus green test#3, question #44
It's not a secret anymore!