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?
Author and all-around good cowpoke
posted 13 years ago
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 ]
Onion rings are vegetable donuts. Taste this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user