Scheduling a task at a specific time of day, every day in Java

This example will run the thread PrintTask every day at 04h28m30s (just because I wrote this example at that time :).

import java.util.*;
public class Scheduler
   public static void main(String []args) {
      Timer timer = new Timer();
      Calendar calendar = Calendar.getInstance();
      calendar.set(Calendar.HOUR_OF_DAY, 4);
      calendar.set(Calendar.MINUTE, 28);
      calendar.set(Calendar.SECOND, 30);
      Date time = calendar.getTime();
      timer.schedule(new PrintTask(),
   static class PrintTask extends TimerTask {
      public void run() {
         System.out.println("Task executed");