Problems with Java timer class.

Caporegime
Joined
12 Mar 2004
Posts
29,962
Location
England
I'm trying to use the timer class to repeat an action after a fixed amount of time, but I can't even get it to print the message once, as I keep getting the error. "exception in thread "Timer-0" java.lang.IllegalStateException: Task already scheduled or cancelled
 
Last edited:
It probably increments once as you have a call to dispensepetrol() at the end of your constructor.


Ah right, thats how I was testing whether the method works or not. I'll try it by calling the method via another method.
 
Last edited:
Back
Top Bottom