• Post Reply Bookmark Topic Watch Topic
  • New Topic

return in thread.  RSS feed

 
Vikas Sahu
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Can any body tell me what happened if I use return statement in java thread's run() method.

Ex:

public void run(){
If condition is true:
return ;
else
go ahead...
}


Vikas
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Vikas Sahu
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no if returning from run() method then else block woudnt execute.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15865
81
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vikas Sahu:
Hi Can any body tell me what happened if I use return statement in java thread's run() method.

If you return from the run() method in a thread, the thread finishes (and stops running).
 
Amit A. Patil
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Thread has died gracefully!!!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!