• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread class Methods

 
sharma ishu
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21518
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sharma ishu wrote:
It was in some mock test. NOT in real exam.


Please QuoteYourSources.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic