This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Getting started with Java programming language and have Ashish Sarin & J Sharma on-line!
See this thread for details.
Win a copy of Getting started with Java programming language this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between Thread and Timer  RSS feed

 
Raja ji
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all,

Can anybody tell me what is the differece between Timer and Thread.
When to use Timer and when to use Thread.
 
madan singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

You can start the timer on some specific time but not in case of thread.
Thread can implements Singleton(to make low heapSize).
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Timer is essentially a thread scheduled for execution at one ore more specific times. If you look at the API for TimerTask (which is what gets scheduled), you'll see that it is just about the same as Thread.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!