This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread Program  RSS feed

 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good evening to all,


any one explain the follow of the program
regards
rex
 
ahmed yehia
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here nothing special is happening, you are creating and starting two threads which run concurrently. Try the below program (added yield()) and notice how threads take turns although output isnt guaranteed in both cases.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!