What is Timer and TimerTask in Java � Tutorial Example

Timer in Java is a utility class which is used to schedule tasks for both one time and repeated execution. Timer is similar to alarm facility many people use in mobile phone. Just like you can have one time alarm or repeated alarm, You can use java.util.Timer to schedule one time task or repeated task. In fact we can implement a Reminder utility using Timer in Java and that's what we are going to see in this example of Timer in Java. Two classes java.util.Timer and java.util.TimerTask is used to schedule jobs in Java and forms Timer API. TimerTask is actual task which is executed by Timer. Similar to Thread in Java, TimerTask also implements Runnable interface and overrides run method to specify task details. This Java tutorial will also highlight difference between Timer and TimerTask class and explains how Timer works in Java. By the way difference between Timer and Thread is also a popular Java questions on fresher level interviews.
Read more �

Komentar

Postingan populer dari blog ini

Cara Membuat Halaman Login Hotspot Berbeda pada 1 Mikrotik

UltraISO Premium Edition v9.5.3

Arti OSAKMJ