This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread question" Watch "Thread question" New topic
Author

Thread question

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9470
    
    2

Guys, the question below is from here

Question:
All public methods in the Thread class are static and therefore only affect the current thread. True Or False?


1. True
2. False

Answer:
1

How can it be true??? what about join() and setPriority???they are not static??


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Just check the Thread API. If just one public method is not static, then the answer must be false. What about run() for example?

Could be the author meant to restrict the question to only the Static members:
All public static methods in the Thread only affect the current thread

Regarding join() and setPriority(), look at the API to determine if they are static or not.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9470
    
    2

The join() and setPriority() methods are not static. They are just final methods.
 
 
subject: Thread question