Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MultiThreading

 
Tukaram Ugile
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

what is the difference between stop() and yield()?

As far as I know yield method keeps the currently running thread in ready-to-run state.What happens when the stop() method is called on the currently running thread?What is the state of the thread?

Thanks.

 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you give it a try. Take a look at the documentation for the stop method in the -> java.lang.Thread class
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stop method is deprecated so you don't have to worry about it for SCJP...
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tukaram Ugile wrote:Dear All,

what is the difference between stop() and yield()?

As far as I know yield method keeps the currently running thread in ready-to-run state.What happens when the stop() method is called on the currently running thread?What is the state of the thread?

Thanks.



It will go to Dead state. No more Thread - of - execution!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic