This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes William Brogden  MOCK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "William Brogden  MOCK" Watch "William Brogden  MOCK" New topic
Author

William Brogden MOCK

Sarma Lolla
Ranch Hand

Joined: Oct 21, 2002
Posts: 203
Question 55
Which of the following are public variables or methods that belong to an instance of Thread?
Do not select static variables, static methods, or deprecated methods.
Choice Option Text
a - wait() method
b - sleep() method
c - start() method
d - MAX_PRIORITY - an int variable
e - daemon - a boolean variable
Correct answers are a) and c). But given that the correct answers can be one or more as the general statement how can any one guess a) as answer?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
I'll admit that one is a little tricky. Here is the complete script:

TXT:1: Which of the following are public variables or methods that belong to an instance of Thread?
TXT:2: Do not select static variables, static methods, or deprecated methods.
OPT:a: wait() method
OPT:b: sleep() method
OPT:c: start() method
OPT : MAX_PRIORITY - an int variable
OPT:e: daemon - a boolean variable
ANS:a: Yes, since wait is a method in Object and Thread is an object.
ERR:b: No, sleep is a static method.
ANS:c: Yes, start is an instance method of Thread.
ERR : No, MAX_PRIORITY is a static final variable of Thread.
ERR:e: No, the daemon boolean variable is a private instance variable.

What I am trying to get at there is to remind you that objects have methods inherited all the way back to Object.
Even though I can't think of a reason to design a program such that wait method would be called, you should still recognize that it has one by virtue of inheritance.
Bill
[ March 03, 2003: Message edited by: William Brogden ]
 
jQuery in Action, 2nd edition
 
subject: William Brogden MOCK
 
Similar Threads
JQ+ Question
which is valid statement in this question
Why static methods can't be defined inside Inner classes
Static
Static clarifications required