In this section, you can learn how to schedule a timer task to run at a certain time and repeatedly. There is an example given for the illustration. This program asks you for the way of performing the task whether at the certain time or repeatedly. If you enter the "c" then the program will perform the timer task at a certain time means the task will work only once while you enter the "r" then the program performs the timer task repeatedly until you terminate the program.
This program has used the following method for the appropriate:
Above method of Timer class sets the schedule for the specific task. In this program, this method has been used two times. First time two parameters have passed through the method as follows:
Second time three parameters have passed to the method which are explained as follows in which explanation of of the first two arguments are given above and the third is as:
Here is the code of the program:
Liked it! Share this Tutorial