| Author |
Thread class Methods
|
sharma ishu
Ranch Hand
Joined: Sep 10, 2012
Posts: 70
|
|
Which of the following are methods of the Thread class?
1) yield()
2) sleep(long msec)
3) go()
4) stop()
Answer: 1,2 and 4.
Why is option 4 valid?
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3793
|
|
Have you looked at the Thread class documentation?: java.lang.Thread#stop()
It's a deprecated method you shouldn't use, though. That might be an old question. Where are you quoting it from?
|
 |
sharma ishu
Ranch Hand
Joined: Sep 10, 2012
Posts: 70
|
|
Matthew Brown wrote:Have you looked at the Thread class documentation?: java.lang.Thread#stop()
It's a deprecated method you shouldn't use, though. That might be an old question. Where are you quoting it from?
This is from a mock test of year 2009.
So, you mean to say that if this question occurs in the exam now then only options 1 and 2 will be correct? Please tell me if I am right or wrong.
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3793
|
|
sharma ishu wrote:This is from a mock test of year 2009.
So, you mean to say that if this question occurs in the exam now then only options 1 and 2 will be correct? Please tell me if I am right or wrong.
The method still exists in the Thread class, so 4 would still be correct. But I think it would be a very poor question to ask about deprecated methods. But then, it was already a poor question in 2009. I'd be surprised if the real exam asked it, but I can't be sure they wouldn't.
|
 |
sharma ishu
Ranch Hand
Joined: Sep 10, 2012
Posts: 70
|
|
Matthew Brown wrote:
sharma ishu wrote:This is from a mock test of year 2009.
So, you mean to say that if this question occurs in the exam now then only options 1 and 2 will be correct? Please tell me if I am right or wrong.
The method still exists in the Thread class, so 4 would still be correct. But I think it would be a very poor question to ask about deprecated methods. But then, it was already a poor question in 2009. I'd be surprised if the real exam asked it, but I can't be sure they wouldn't.
It was in some mock test. NOT in real exam.
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16692
|
|
sharma ishu wrote:
It was in some mock test. NOT in real exam.
Please QuoteYourSources.
Henry
|
 |
 |
|
|
subject: Thread class Methods
|
|
|