• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JavaCaps Question 41

 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is taken from the mock exam at: http://www.javacaps.com/sjpc_mockexam.html
I beleive that this answer is wrong, wanted to get others opinion.

The answer given is A,B, and D.
I agreed on B and D, but with A, I thought the start() method makes it eligible to run, but it is the schedular that makes it run.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill,
I agree with you - it is wrong. RHE refers to needing "a run() method for the thread scheduler to invoke" (p.203). I think it's trying to get at the fact that you don't have to code a direct call to run() but start() just tells the scheduler that the thread's eligible to run. Start() can't call run because when it actually gets to run is system dependent. In that sense it's a bit like garbage collection - you can make something available for garbage collection but when it's collected depends on how the system schedules stuff.
Kathy
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with your choices A,B. But I didnt understand that the option D (A stop() method kills the currently running Thread). Give your explanation.

 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The stop() method is now deprecated, so you won't get that on the 1.2 test. It has been replaced by the interrupt() method, but the purpose of the stop() method was to stop the currently running thread.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the link Bill.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic