• 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

Stop a thread

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What wight cause the current thread to stop excutings?
A.thread of higher priority become ready
(yield-methode).
B.method sleep() be called.
C.method stop() be called
D.method suspend() be called.
E.method wait() be called
I think the answers are A, B, C, D, E.
Does a call to the wait method stop a thread?
Thanks for your answers.
Thomas.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming "stop" in this question does not mean
that the thread cannot resume at a later time, then all options are correct, in my opinion.
If "stop" in this question means a final halt of the thread's execution, then only the (deprecated) method stop() will do it.
wait() is a method of Object.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question is testing your understanding of the thread life cycle and the different states that a thread can be in which are all described in The Life Cycle of a Thread Lesson of Sun's Java Tutorial on Threads.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic