Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

yield

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is a question from Jexam:
which will definitely stop a thread from executing?
1) stop //true
2)sleep //true
3)suspend //true
4)yield() // given as correct.
But,I have choosen as false.since yield() brings the Thread
to ready state.And it may or may not stop executing
depending on the i/p in Thread Scheduler.
Thanks!

 
Louise Haydu
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am surprised that 'stop' and 'suspend' are listed as true since these methods are deprecated in Java 1.2. In other mock exams I've taken, the use of deprecated methods was always viewed as an incorrect answer.
As for 'yield,' I had thought that the thread would be 'stopped' while the scheduler looks to see if there is another runnable thread to execute. Even tho' the same thread could be chosen to execute, the thread still seems to be stopped while the scheduler does its checking.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic