Whenever you create a Timer, it creates and starts a single thread of its own, which it uses to fun all the tasks you schedule for it, in order, at the times you schedule (or as soon as possible thereafter). A single Timer should never run its scheduled TimerTasks in parallel - but if you had two different Timers, they could run their TimerTasks in parallel. Does that help?
Show some code where you define the inner class. That whole "inner class can access variables in the enclosing class" business can be confusing. You can almost always avoid it by defining the TimerTask in its own top level class and source file.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Whenever you create a Timer, it creates and starts a single thread of its own, which it uses to fun all the tasks you schedule for it, in order, at the times you schedule (or as soon as possible thereafter). A single Timer should never run its scheduled TimerTasks in parallel - but if you had two different Timers, they could run their TimerTasks in parallel.
does this mean that I can create an application that uses Timers for different objects without having to put my Timers in their own threads?
say for example I have a calulator program that I can only use for a fixed amount of time, one I start punching a key the timer automatically starts, I can continue using the calculator while the Timer runs on it's own thread without putting it in a new thread?