With the Thread class you could create your own timer class using the Thread.sleep(T) method to delay action for some time . This approach, however, has some drawbacks. For periodic events, if the processing times in between the sleep periods vary significantly, then the overall timing will mismatch. Also, if you need many timer events, the program will require many threads and use up system resources.
We can create a Timer functionality withExecutor frameworks and also there is Timer and Timertask available in java.util package. We will see both methods to create Timer functionality.