Source Code : Create a scheduled task using timer
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Create a scheduled task using timer
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
public class Main extends TimerTask {
private DateFormat formatter = new SimpleDateFormat("hh:mm:ss a");
public static void main(String[] args) {
TimerTask task = new Main();
Timer timer = new Timer();
timer.scheduleAtFixedRate(task, new Date(), 1000);
}
public void run() {
System.out.println(formatter.format(new Date()));
}
}
Thank with us