When you want to execute a periodic task using the Executor framework, you need a ScheduledExecutorService object. To create it (as with every executor), Java recommends the use of the Executors class. This class works as a factory of executor objects. In this case, you used the newScheduledThreadPool() method to create a ScheduledExecutorService object. This method receives the number of threads of the pool as a parameter. Since you had only one task in this example, you passed 1 as a parameter.
Once you had the executor needed to execute a periodic task, you sent the task to the executor. You used the scheduledAtFixedRate() method. This method accepts four parameters: the task you want to execute periodically, the delay ...