Many times we have to write some set of task which can be executed after a certain interval of time. These types of task are called timer task.
So we can achieve it by using threads which will sleep for a certain amount of time and execute again. But wait, Can Java do this for me So that I can focus on logic instead of worrying about how to schedule tasks for me?
Yes, Java can do the scheduling thing for you. So you write your logic and let Java handle the scheduling work.