This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

I need a Thread Example please  RSS feed

 
Karis Brown
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every time i get an example of how to do a thread, it tells me "Deprecated"
which i think means the code I am using is to old!
Can someone give me a 1.42 version please?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you find your samples? Sun has pretty good tutorials - Google for "Sun thread tutorial" or "java thread tutorial" to find millions more.
Feel free to post some of the code that's bothering the compiler and let the ranch hands try to fix it up.
 
Karis Brown
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it? can u send any links you are aware of please.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun's Java tutorial is here.
The important deprecated methods in Thread are stop(), suspend(), and resume(). The solution is simple: don't use them. Write your threads so that they will stop -- i.e., break out of a loop -- when you set a flag; then provide a method to set that flag, and you've got your own "stop"-like mechanism.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!