File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread question" Watch "Thread question" New topic

Thread question

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032

Guys, the question below is from here

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

1. True
2. False


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: 10032

The join() and setPriority() methods are not static. They are just final methods.
I agree. Here's the link:
subject: Thread question
It's not a secret anymore!