Meaningless Drivel is fun!*
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Marcus green test#3, question #44" Watch "Marcus green test#3, question #44" New topic
Author

Marcus green test#3, question #44

Christy Smith
Greenhorn

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
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??
Mark Brossard
Greenhorn

Joined: Aug 24, 2001
Posts: 3
Have a look at:
http://www.javaranch.com/ubb/Forum24/HTML/004488.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Marcus green test#3, question #44