• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

yield

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic